2012-12-22 40 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; 
    } 
}