我正在尋找一些提示如何做我目前想做的事情。nginx反向代理apache2網站:url返回與代理服務器不對應
這裏就是我該做的: 的Nginx服務器代理(srvrp) - >的Apache2(srvdeba)
這裏是nginx的網站srvrp的配置:
server {
server_name www.egloff-j-quest-etna.nx;
location/{
proxy_pass http://srvdeba.egloff-j-quest-etna.nx;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $proxy_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
}
}
這裏是配置在srvdeba啓用站點的網站:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.srvdeba.egloff-j-quest-etna.nx
ServerAlias *srvdeba.egloff-j-quest-etna.nx
DocumentRoot /opt/wordpress
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /opt/wordpress/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
目前,這是工作,但不完全,問題如下: 當該網站是通過代理服務器加載,網站上所有的鏈接都是這種形式: http://srvdeba.egloff-j-quest-etna.nx 我希望他們對應: www.egloff-J-追求-etna.nx
於是,我想到了有兩種解決方案,第一種解決方案是使用ngx_http_sub_module ,第二種解決方案是配置apache2,以便他知道他正在被代理,並且可以在通過代理服務器完成請求時重寫URL。 srvdeba必須在沒有代理服務器的情況下訪問時才能工作。 所以我需要你告訴我什麼是最好的解決方案!
在此先感謝您的答案。
那麼,我試過ngx_http_sub_module,它根本不工作。也許我做了一些錯誤的事情。現在我將嘗試配置apache2。 – laxa 2014-10-11 15:29:56