Skip to content

Instantly share code, notes, and snippets.

@ahmadazimi
Last active November 28, 2020 07:04
Show Gist options
  • Save ahmadazimi/92155240d1f601192898 to your computer and use it in GitHub Desktop.
Save ahmadazimi/92155240d1f601192898 to your computer and use it in GitHub Desktop.
Laravel Nginx Php-fpm server configuration file (Centos 7)
server {
server_name www.abc.com;
return 301 $scheme://abc.com$request_uri;
}
server {
listen 80;
server_name abc.com;
charset utf-8;
root /usr/share/nginx/html/abc.com/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 30d;
}
location ~ /\. {
deny all; access_log off; log_not_found off;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
client_max_body_size 100m;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment