Created
January 12, 2015 08:25
-
-
Save reatang/1d996adbcbd2f8e37cfc to your computer and use it in GitHub Desktop.
nginx vhost配置文件
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; | |
client_max_body_size 100M; | |
server_name localhost; | |
charset utf-8; | |
set $root /Users/reatang/www/; | |
index index.php; | |
root $root; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; | |
} | |
include php.conf; | |
#网站的图片较多,更改较少,将它们在浏览器本地缓存15天 | |
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ | |
{ | |
expires 15d; | |
} | |
#网站会加载很多JS、CSS,将它们在浏览器本地缓存1天 | |
location ~ .*\.(js|css)?$ | |
{ | |
expires 1d; | |
} | |
# 访问日志 | |
access_log /var/log/nginx/localhost.access.log; | |
# 错误日志 | |
error_log /var/log/nginx/localhost.error.log; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fastcgi.conf
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;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;