Skip to content

Instantly share code, notes, and snippets.

@ikarius6
Created February 12, 2016 19:35
Show Gist options
  • Save ikarius6/25972f62178b4ada4af6 to your computer and use it in GitHub Desktop.
Save ikarius6/25972f62178b4ada4af6 to your computer and use it in GitHub Desktop.
Vhost example Nginx, CI on subfolder and pretty URLs
################################################################################
####################
### Virtual Host for entuhogar.dev subdomain
################################################################################
####################
server {
listen *:80;
server_name entuhogar.dev
### Front public folder
index index.html;
### /route/of/project/source/web/
root /usr/share/nginx/www/front/source/web/;
access_log /var/log/nginx/entuhogar.log;
error_log /var/log/nginx/entuhogar.log;
### Codeigniter pretty URLs
location /backend {
try_files $uri $uri/ /backend/index.php;
}
location ~ ^/backend/(index\.php)(/|$) {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_read_timeout 600;
}
### End Codeigniter pretty URLs
### Deny all . files
location ~ /\. {
deny all;
}
### Deny PHPs, JSONS and SQL backups
location ~ (\.php|\.json|\.sql)(/|$) {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment