Created
July 13, 2014 10:32
-
-
Save romiras/24e72d48270b89db3043 to your computer and use it in GitHub Desktop.
This file contains 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
upstream php { | |
server unix:/tmp/php-cgi.socket; | |
server 127.0.0.1:9000; | |
} | |
server { | |
listen 80; ## listen for ipv4 | |
# listen [::]:80 default ipv6only=on; ## listen for ipv6 | |
server_name blog.domain.com; | |
# root /var/www; | |
root /home/wpuser/blog; | |
index index.php index.html; | |
try_files $uri $uri/ /index.php$is_args$args; | |
access_log /var/log/nginx/localhost.access.log; | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
# This is cool because no php is touched for static content. | |
# include the "?$args" part so non-default permalinks doesn't break when using query string | |
try_files $uri $uri/ /index.php?$args; | |
# fastcgi_index index.php; | |
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
} | |
# and finally, the magic that makes PHP work. if the file being requested ends in ".php" | |
# it's something that PHP-FPM should process, so hand it to our named upstream server | |
location ~ \.php$ { | |
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
include fastcgi.conf; | |
fastcgi_intercept_errors on; | |
fastcgi_pass php; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
#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 /var/www/nginx-default; | |
#} | |
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | |
# | |
#location ~ \.php$ { | |
#proxy_pass http://127.0.0.1; | |
#} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
# | |
#location ~ \.php$ { | |
#fastcgi_pass 127.0.0.1:9000; | |
#fastcgi_index index.php; | |
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | |
#includefastcgi_params; | |
#} | |
# 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