Skip to content

Instantly share code, notes, and snippets.

@InFog
Created October 1, 2014 22:37
Show Gist options
  • Save InFog/42082e3c03543d7e05c7 to your computer and use it in GitHub Desktop.
Save InFog/42082e3c03543d7e05c7 to your computer and use it in GitHub Desktop.
Nginx basic example with rewrite and PHP-FPM
server {
server_name example;
root /var/www/example;
index index.php index.html index.htm;
# error_log /var/log/nginx/example.error_log debug;
rewrite_log on;
location ~* ^/(assets|css|fonts|img|js|upload) { }
location / {
try_files $uri $uri/ /index.php?/$request_uri;
}
# PHP-FPM
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/vortexnet$fastcgi_script_name;
include fastcgi_params;
}
# No access do htaccess
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment