Last active
February 20, 2017 23:31
-
-
Save ahmedash95/187176158ff40b1a9f5f9be29c95d254 to your computer and use it in GitHub Desktop.
Laravel Nginx Conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
# default server specification | |
listen 80 default_server; | |
# site accessible from http://domain_or_ip | |
server_name _; | |
# file location | |
root /var/www/html/my_project/public; | |
index index.php index.html index.htm; | |
# check if a file or directory index file exists, else route it to 404 error page. | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
# error pages | |
error_page 404 /404.html; | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
# handle execution of PHP files | |
# set php5-fpm socket | |
# tell NGINX to proxy requests to PHP FPM via the FCGI protocol | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment