Skip to content

Instantly share code, notes, and snippets.

@aasumitro
Last active September 1, 2019 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aasumitro/542fd25d118baf5e9c1571df5f93587b to your computer and use it in GitHub Desktop.
Save aasumitro/542fd25d118baf5e9c1571df5f93587b to your computer and use it in GitHub Desktop.
codeigniter in main and subfolder with nginx
server {
listen 80;
listen [::]:80;
server_name dev.seanesia.com www.dev.seanesia.com;
root /var/www/dev/frontoffice;
index index.php index.html;
location / {
access_log /var/www/dev/log/fo/access.log;
error_log /var/www/dev/log/fo/errors.log;
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
try_files $uri /index.php =404;
include fastcgi_params;
fastcgi_index /var/www/dev/frontoffice/index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_split_path_info ^(.+\.php)(/.+)\$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 600;
}
location ~ /\.ht { deny all; }
location ~ ^/(application|system|tests)/ { return 403; }
location ^~ /backoffice {
alias /var/www/dev/backoffice;
access_log /var/www/dev/log/bo/access.log;
error_log /var/www/dev/log/bo/errors.log;
#if (!-e $request_filename) { rewrite ^ /bo/index.php last; }
try_files $uri /backoffice/index.php;
location ~ \.php$ {
try_files $uri /index.php =404;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)\$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index /var/www/dev/backoffice/index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 600;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
location ~ /\.ht { deny all; }
location ~ ^/(application|system|tests)/ { return 403; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment