Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

CLOSED

Update 2

Suddenly it works - must be a cache problem.

Updated

I installed lynx, edited /etc/hosts and checked the apache configuration from the command line - it works - it must be the nginx configuration...


I am trying to run WordPress under Apache2 behind nginx and I can't get to work - nor can I work out how to debug it.

This is my conf file for nginx:

server {
   listen        80;
   server_name   blog2.vixo.com;

   location / {
        proxy_pass              http://127.0.0.1:8765/;
        proxy_set_header        X-Forwarded-For      $proxy_add_x_forwarded_for;
        proxy_set_header        HN-Host              $host;
        proxy_set_header        HN-Port              $server_port;
        proxy_set_header        Host                 $host;
        proxy_buffering         off;
        proxy_read_timeout      3600;
   }
}

I have a ports.conf for apache2 saying:

NameVirtualHost 127.0.0.1:8765
Listen 8765

And then two files in /etc/apache2/site-enabled

The default:

<VirtualHost 127.0.0.1:8765>
    ServerAdmin webmaster@localhost
    ServerName wordpress.vixo.com

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

and the secondary one:

<VirtualHost 127.0.0.1:8765>
    ServerAdmin webmaster@localhost
    ServerName blog2.vixo.com

    DocumentRoot /hn/files-www/blog2.vixo.com
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /hn/files-www/blog2.vixo.com>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

The directory /var/www contains a WordPress installation and the directory /hn/files-www/blog2.vixo.comcontains just a nonce index.html

But when I open http://blog2.vixo.com in the browser I get a page saying Error establishing a database connection which is characteristic of a WordPress misconfiguration error.

Here is the output of sudo apache2ctl -S:

VirtualHost configuration:
127.0.0.1:8765    is a NameVirtualHost
         default server wordpress.vixo.com (/etc/apache2/sites-enabled/000-default:1)
         port 8765 namevhost wordpress.vixo.com (/etc/apache2/sites-enabled/000-default:1)
         port 8765 namevhost blog2.vixo.com (/etc/apache2/sites-enabled/blog:1)
Syntax OK

I don't really know how to figure out how Apache2 is resolving what it gets from nginx.

Even when I explicitly setup a single VirtualHost with an explict name it still passes the http request through to it.

share|improve this question
2  
Before helping with this, would like to understand why you want to run this setup for wordpress? You can easily setup wordpress simply on nginx itself. –  GeekRide Dec 11 '12 at 12:49
    
I have two blogs - one in wordpress one not, and I want to shift the second one to wordpress. I also want no down time, and the wordpress blog is on the wrong disk partition (just playing). So I am trying to get a configuration where I can have two standalone WordPress installs and cut-over the blogs live. (I have nginx running as standard because there are other services/webserver running...) –  Gordon Guthrie Dec 11 '12 at 13:44

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.