我最近得到了一个带有Nginx的VPS并且移动了我的wordpress实例.经过一番浏览后,我得到了永久性的工作.该博客位于博客文件夹中.
我想将example.com的请求重定向到example.com/blog.但是,请求toexample.com/doc / …不应重定向到example.com/blog/doc / ….
我已经寻找其他问题/答案,但它们都导致了无限重定向循环.
这是当前的配置:
server { listen 80; # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf; root /usr/share/Nginx/html; # Add index.PHP to the list if you are using PHP index index.html index.htm index.Nginx-debian.html index.PHP; server_name mysite.com; location / { # Redirect to /blog } location /blog/ { try_files $uri $uri/ /blog/index.PHP?$args; } # deny access to .htaccess files,if Apache's document root # concurs with Nginx's one location ~ /\.ht { deny all; } # pass the PHP scripts to FastCGI server listening on the PHP-fpm socket location ~ \.PHP${ try_files $uri =404; fastcgi_pass unix:/var/run/PHP5-fpm.sock; fastcgi_index index.PHP; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
“`