# Yii2 Config

# Disable GII

---

Gii code generator can disable by adjusting config for either frontend and backend.

- **Frontend**
    
    
    1. Go to `app/frontend/config/main-local.php`
    2. Comment or remove this line.
    
    ```php
      if (!YII_ENV_TEST) {
        $config['bootstrap'][] = 'debug';
        $config['modules']['debug'] = [
            'class' => 'yii\debug\Module',
        ];
        $config['bootstrap'][] = 'gii';
        $config['modules']['gii'] = [
            'class' => 'yii\gii\Module',
        ];
      }
    
    ```
- **Frontend**
    
    
    1. Go to `app/backend/config/main-local.php`
    2. Comment or remove this line.
    
    ```php
      if (!YII_ENV_TEST) {
        $config['bootstrap'][] = 'debug';
        $config['modules']['debug'] = [
            'class' => 'yii\debug\Module',
        ];
        $config['bootstrap'][] = 'gii';
        $config['modules']['gii'] = [
            'class' => 'yii\gii\Module',
        ];
      }
    
    ```

# Launchpad

https://launchpad.net/ubuntu/+archivemirrors

# Arahan Untuk Setiap Servis

### Nginx Service

```bash
# Start Nginx
sudo systemctl start nginx

# Stop Nginx
sudo systemctl stop nginx

# Restart Nginx
sudo systemctl restart nginx

# Reload Nginx (without downtime)
sudo systemctl reload nginx

```

### MySQL Service

```bash
# Start MySQL
sudo systemctl start mysql

# Stop MySQL
sudo systemctl stop mysql

# Restart MySQL
sudo systemctl restart mysql

```

### PHP 8.3-FPM Service

```bash
# Start PHP-FPM
sudo systemctl start php8.3-fpm

# Stop PHP-FPM
sudo systemctl stop php8.3-fpm

# Restart PHP-FPM
sudo systemctl restart php8.3-fpm

```

Lihat status setiap servis

```bash
sudo systemctl status service_name
# Example: sudo systemctl status nginx

```

# Secure Cookies

```
'session' => [
		    'name' => 'FrontendSessionPetra',
            'cookieParams' => [
                'httpOnly' => true,
                'secure' => true
            ]
        ],
        'cookies' => [
		    'cookieValidationKey' => '55842521143P0o&&YjFFPetra',
            'csrfParam' => '_backendCSRF',
            'class' => 'yii\web\Cookie',
            'httpOnly' => true,
            'secure' => true
        ],
        'request' => [
            'csrfCookie' => [
                'httpOnly' => true,
                'secure' => true
            ]
        ],
        'user' => [
            'identityClass' => 'common\models\FrontendUser',
            'enableAutoLogin' => true,
			'identityCookie' => [
                'name' => '_identity',
                'httpOnly' => true,
                'secure' => true,
            ],
        ],

```

```
Header always edit Set-Cookie ^(.*)$ "$1; HttpOnly; SameSite=Lax; Secure"

```