
1 ryd994 2015-04-08 22:30:01 +08:00 via Android 这样就是 |
4 boro OP @ryd994 配置如下: server { listen 127.0.0.1:8080; server_name www.vvv.com youmane.com; root /var/www/www.vvv.com/public_html; index index.php index.html; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location ~ /\. { deny all; access_log off; log_not_found off; } location / { try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ { expires max; log_not_found off; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } |
5 boro OP |
7 FastMem 2015-04-10 10:00:17 +08:00 推荐使用官方的, 或者用rewrite 写法官方的这样: server { listen 80; server_name example.org; return 301 http://www.example.org$request_uri; } server { listen 80; server_name www.example.org; #DO } 如果rewrite这样 server { listen 80; server_name example.org; rewrite ^(.*) http://www.dexample.org/$1 permanent; } server { listen 80; server_name www.example.org; #DO } |
9 boro OP @ryd994 我贴出的事原本的配置样列,按照nginx的建议写法,在top部位加入 server { listen 80; server_name example.org; return 301 http://www.example.org$request_uri; } 就出现无限循环了。 |
10 ryd994 2015-04-12 01:28:45 +08:00 |
11 boro OP |
12 ryd994 2015-04-12 20:44:47 +08:00 via Android |