2012-12-22 61 views
2

我在將nginx配置爲反向代理時遇到了一些問題。nginx作爲運行apache的反向代理

可以說我有一個VPS,kloxowebmin在我的VPS上安裝並運行多個域。

我已經通過REPELYUM安裝nginx這是我/etc/nginx/nginx.conf文件 在這個link給出。

我將Apache端口更改爲8080,並重新啓動服務進行更改並啓動nginx,並且存在一些問題。

當我嘗試對我的CentOS VPS達到每域,我面對APACHE START PAGE (WELCOME PAGE),當我在瀏覽器中輸入我的VPS IP像x.x.x.x,我面對NGINX START PAGE (WELCOME PAGE)

我想nginx服務我的靜態文件,並將動態文件重定向到Apache以獲得更好的性能。

回答

0

有從書Nginx的HTTP服務器爲例,頁235

server { 
    server_name .example.com; 
    root /home/example.com/www; 
    location ~* \.php.$ { 
     # Proxy all requests with an URI ending with .php* 
     # (includes PHP, PHP3, PHP4, PHP5...) 
     proxy_pass http://127.0.0.1:8080; 
    } 
    location/{ 
     # Your other options here for static content 
     # for example cache control, alias... 
     expires 30d; 
    } 
}