Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '', has every link pointing at the amazon host, 'ec2----*'. I would like for all of these links to resolve using the '' 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;

    root   /var/www/;
    index  index.html index.htm index.php;

    # pass the PHP scripts to FastCGI server listening on
    location ~ \.php$ {
        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/ 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!

share|improve this question
up vote 1 down vote accepted

That's because wordpress keeps the URL/domain name in the database settings. You need to login to the wordpress wp-admin and update the site url or simply update it directly in the database.

share|improve this answer
That was it! Totally noob question....thanks for your help! – Bryan Oct 8 '10 at 1:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.