Created
August 28, 2014 03:08
-
-
Save 582033/e5f31a3545596fd1abe9 to your computer and use it in GitHub Desktop.
nginx
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 8000; | |
server_name localhost; #绑定域名 | |
root /var/www/cake; #网站根目录 | |
index index.htm index.html index.php; #默认文件 | |
error_page 404 = /404/index.html; | |
location ~ \.php$ { | |
fastcgi_pass unix:/etc/nginx/fastcgi.sock; | |
fastcgi_index index.php; | |
include /etc/nginx/fastcgi_params; #fastcig_params参数文件地址 | |
} | |
location ~ .*\.(png|gif|jpg){ | |
expires 30d; | |
} | |
location ~ .*\.(js|css){ | |
expires 10d; | |
} | |
access_log /var/log/nginx/access_cake.log; | |
error_log /var/log/nginx/error_cake.log; | |
} | |
server { | |
listen 80 default; | |
server_name yjiang.tk; #绑定域名 | |
if ($host != 'yjiang.tk') { | |
rewrite ^/(.*)$ http://yjiang.tk/$1 permanent; | |
} | |
location ~ .*\.(jpg|png|gif){ | |
expires 30d; | |
} | |
location ~ .*\.(js|css){ | |
expires 10d; | |
} | |
location / { | |
proxy_pass http://127.0.0.1:88; | |
include /etc/nginx/proxy_params; | |
} | |
} | |
server { | |
listen 443 ssl spdy; | |
server_name yjiang.tk; #绑定域名 | |
ssl_certificate ssl/server.crt; | |
ssl_certificate_key ssl/server.key; | |
if ($host != 'yjiang.tk') { | |
rewrite ^/(.*)$ https://yjiang.tk/$1 permanent; | |
} | |
location ~ .*\.(jpg|png|gif){ | |
expires 30d; | |
} | |
location ~ .*\.(js|css){ | |
expires 10d; | |
} | |
location / { | |
proxy_pass http://127.0.0.1:88; | |
include /etc/nginx/proxy_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment