I'm currently trying to set up a virtual host in Nginx so that I can run a wordpress server as though it were on a different domain. The problem I'm currently having is that the wordpress server, while displaying when I go to 'http://example-domain.com/blog/', has every link pointing at the amazon host, 'ec2----*.compute-1.amazonaws.com'. I would like for all of these links to resolve using the 'example-domain.com' host.
My Main Nginx conf file (nginx.conf) is:
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 2;
#gzip on;
# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
#
# The default server
#
server {
listen 80;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
The virtual host is set up with the following conf:
server {
listen 80;
server_name example-domain.com;
root /var/www/example-domain.com/html;
index index.html index.htm index.php;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
The wordpress folder is located at /var/www/example-domain.com/html/blog/. Does anyone have any idea why all the wordpress links on the front page use the ec2 host name and not the one defined in the virtual host configuration? If so please help me out.
Thanks in advance!