Deployment
server { set $project_root /path/to/ildis.go.id; #set $fcgi_server 127.0.0.1:9000; set $fcgi_server unix:/var/run/php-fpm/example.socket;
charset utf-8; client_max_body_size 128M;
listen 80;
server_name ildis.go.id; root $project_root/; index index.php;
access_log /var/log/nginx/ildis.access.log combined; error_log /var/log/nginx/ildis.error.log warn;
location ^~ /backend { rewrite ^/backend(.*)$ /backend/$1 last; }
location ^~ /backend/ { root $project_root;
# uncomment the following, if you want to enable speaking URL in the backend #try_files $uri $uri/ /backend/index.php$is_args$args;
location ~ /\.(ht|svn|git) { deny all; }
location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_pass 127.0.0.1:9000; fastcgi_pass $fcgi_server; try_files $uri =404; } }
location / { try_files $uri $uri/ /index.php$is_args$args; }
location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|woff2?|ttf|svg|eot|webp|pdf)$ { expires 30d; access_log off; add_header Cache-Control "public"; try_files $uri =404; }
location ~ /\.(ht|svn|git|env|DS_Store) { deny all; }
location ~ ^/(vendor|node_modules|\.vagrant|vagrant|DATABASE|\.github)(/|$) { deny all; return 403; }
location ~* ^/(Vagrantfile|composer\.(json|lock|phar)|package\.json|\.bowerrc|\.gitignore|README.*|CHANGE.*|codeception\.yml|requirements\.php|yii(_test)?(\.bat)?)$ { deny all; return 403; }
location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_pass 127.0.0.1:9000; fastcgi_pass $fcgi_server; try_files $uri =404; }}
Apache
Section titled “Apache”<VirtualHost *:80> ServerName ildis.local #ganti dengan domain anda
#ErrorLog /var/log/apache2/advanced.local.error.log #CustomLog /var/log/apache2/advanced.local.access.log combined AddDefaultCharset UTF-8
Options FollowSymLinks DirectoryIndex index.php index.html RewriteEngine on
RewriteRule /\. - [L,F]
DocumentRoot /path/to/ildis/ <Directory /path/to/ildis/> AllowOverride none <IfVersion < 2.4> Order Allow,Deny Allow from all </IfVersion> <IfVersion >= 2.4> Require all granted </IfVersion>
# if a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward the request to index.php RewriteRule ^ index.php [L] </Directory>
# redirect to the URL without a trailing slash (uncomment if necessary) #RewriteRule ^/admin/$ /admin [L,R=301]
Alias /admin /path/to/ildis/backend/ # prevent the directory redirect to the URL with a trailing slash RewriteRule ^/admin$ /admin/ [L,PT] <Directory /path/to/ildis/backend/> AllowOverride none <IfVersion < 2.4> Order Allow,Deny Allow from all </IfVersion> <IfVersion >= 2.4> Require all granted </IfVersion>
# if a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward the request to index.php RewriteRule ^ index.php [L] </Directory></VirtualHost>
cPanel
Section titled “cPanel”coming soon