Last active
March 10, 2016 19:27
-
-
Save stefan-vatov/4451907 to your computer and use it in GitHub Desktop.
Nginx: Wordpress Virtual Host
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
server{ | |
listen [port]; | |
server_name [url] [www.url]; | |
access_log [access_log_location]; | |
error_log [error_log]; | |
root [where_to_serve_from]; | |
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last; | |
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; | |
location ~* \.(jpg|jpeg|gif|css|png|js|ico|xml)(\?[0-9]+)?$ { | |
access_log off; | |
expires max; | |
fastcgi_hide_header Set-Cookie; | |
log_not_found off; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?$uri&$args; | |
index index.php index.html; | |
port_in_redirect off; | |
} | |
location ~* \.php$ { | |
include /etc/nginx/fastcgi_params; | |
include /etc/nginx/fastcgi_config; | |
fastcgi_split_path_info ^(.+.php)(.*)$; | |
fastcgi_pass [sock-or-address]; | |
fastcgi_index index.php; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param QUERY_STRING $query_string; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment