我让wordpress在mysite.com中工作得很好,但是安装在mysite.com/u中的尤尔斯不能工作,当我点击任何缩短的链接时,我会得到一个404错误(wordpress)。
但是,我通过将此添加到尤尔斯中来使nginx.conf工作。
location /u { try_files $uri $uri/ /u/yourls-loader.php;
但随后WordPress链接中断。
这里是我的默认nginx.conf,我知道修复方法是在nginx.conf中的某个地方添加这个try_files $uri $uri/ /u/yourls-loader.php;,但是在不破坏wordpress的情况下把它放在哪里呢?
===================更新1 =========================
我让这个部分工作了。使用相同的配置,但我注意到以u开头的wordpress链接不起作用:http://example.com/understand-math而是重定向到Error 403 - Forbidden
???
================更新2 ============
好的,我只是将另一个斜杠/添加到location /u/,而不是location /u来修复它。
发布于 2015-01-12 17:14:05
YOURLs NGINX CONFIGURATION
server {
# Listen IPv4 & v6
listen 80;
listen [::]:80;
# Optional SSL stuff
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate example.com.crt;
ssl_certificate_key example.com.key;
# Server names
server_name example.com www.example.com;
# Root directory (NEEDS CONFIGURATION)
root /path/to/files;
# Rewrites
location / {
# Try files, then folders, then yourls-loader.php
# --- The most important line ---
try_files $uri $uri/ /yourls-loader.php;
# PHP engine
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock; # Can be different
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}https://stackoverflow.com/questions/27894988
复制相似问题