Skip to content

Instantly share code, notes, and snippets.

@juliancantillo
Created May 29, 2015 15:46
Show Gist options
  • Select an option

  • Save juliancantillo/d0e410034721f207f915 to your computer and use it in GitHub Desktop.

Select an option

Save juliancantillo/d0e410034721f207f915 to your computer and use it in GitHub Desktop.
nginix with laravel and wordpress
server {
listen 80;
#listen [::]:80 ipv6only=on;
root /srv/staging/inmovis_laravel/public;
index index.php index.html index.htm;
error_log /srv/staging/logs/error.log warn;
# Make site accessible from http://localhost/
server_name stage.app.inmovis.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php$is_args$args;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /blog {
root /srv/staging/inmovis_laravel/blog;
rewrite ^/blog/(.*)$ /$1 break;
# index index.php index.html;
# try_files $uri $uri/ /index.php$is_args$args /index.php?$query_string;
}
location ~ /blog/.+\.php$ {
root /srv/staging/inmovis_laravel/blog;
rewrite ^/blog/(.*)$ /$1 break;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment