Skip to content

Instantly share code, notes, and snippets.

@kenmoini
Last active January 13, 2019 20:21
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 kenmoini/76848b40104f17ba80864f4e32726acb to your computer and use it in GitHub Desktop.
Save kenmoini/76848b40104f17ba80864f4e32726acb to your computer and use it in GitHub Desktop.
Nginx default configuration with some adjustments for Laravel+Wordpress+PHP
upstream php {
server unix:/run/php/php7.2-fpm.sock;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
#Laravel config
try_files $uri $uri/ /index.php?$query_string;
#Wordpress Config
#try_files $uri $uri/ /index.php$is_args$args;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
access_log off;
}
location ~ /\.ht {
deny all;
}
location ~ \.user\.ini$ {
deny all;
}
location ~ \.php$ {
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
#location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|mp3|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)(\?ver=[0-9.]+)?$ {
# access_log off;
# log_not_found off;
# expires max;
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment