Last active
June 6, 2017 21:53
-
-
Save gnzandrs/d66719bd79d63eeaeb4782a76e56fd8b to your computer and use it in GitHub Desktop.
This is a basic configuration to work with php5.6 with nginx on Linux
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 { | |
listen 80; | |
error_log /var/log/nginx/php5.log error; | |
root /var/www/html; | |
index index.php index.html index.htm; | |
server_name example.local; | |
# You would need this line if you want to allow CORS on your server | |
add_header 'Access-Control-Allow-Origin' *; | |
location / { | |
# try_files $uri $uri/ =404; | |
try_files $uri $uri/ /index.php$is_args$args; | |
} | |
location /doc/ { | |
alias /usr/share/doc/; | |
autoindex on; | |
allow 127.0.0.1; | |
deny all; | |
} | |
#error_page 404 /404.html; | |
location ~ \.php$ { | |
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.6-fpm: | |
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment