2015-01-12 24 views
0

我有wordpress在mysite.com中工作得很好 但YOURLS它安裝在mysite.com/u不起作用,當我點擊任何縮短的鏈接時我得到一個404錯誤(wordpress)。Yourls在WordPress中的錯誤

不過,我得到YOURLS加入這一合作,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

+0

你有沒有嘗試這個設置'/可溼性粉劑管理員/選項 - permalink.php'? – vladkras

+0

@Rafael,問題在nginx配置中。 wordpress運行良好,沒有問題。唯一的問題就是把這個'位置/ YOURLS {try_files $ URI $ URI//yourls/yourls-loader.php;'沒有打破WordPress的,我已經包括了任何人都願意幫助我的nginx的配置。 – member0123

回答

0

YOURLS NGINX配置

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; 
    } 
    } 
} 

GITHUB DOCUMENTATION

+0

這是/ yourls安裝在根目錄下,但我有yourls安裝在子目錄中,wordpress安裝在根目錄下,我不知道如何讓它們同時工作。當我修復yourls時,我打破wordpress和viceversa 。 – member0123

+0

[YOURLS WordPress插件(https://wordpress.org/plugins/yourls-link-creator/) – Rafael

+1

我編輯的配置文件,並選擇它作爲公認的答案,謝謝:) – member0123