I have a wordpress blog which is served by apache2(on port 80) and nginx(on port 8080) on Ubuntu 12.04. Now whenever a client connects via port 80 all is hunky dory, but when a client connects to 8080 to view the same blog, the connection is redirected to apache. Why is this happening? I searched around and found that this is a Wordpress limitation that it redirects all connections to the Site URL set in the dashboard(which is port 80 by default).
Is there a way around this? that the connections to port 8080 would be served by nginx rather than apache
Contents of /etc/nginx/sites-enabled/wordpress
server {
listen 8080;
root /var/www;
index index.php index.html index.htm;
server_name abc.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SERVER_PORT 8080;
port_in_redirect off;
}
Any help is appreciated.