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

I'm new to Nginx but was interested in trying it out.

I now have Nginx listening to port 80 and serving static html content from /srv/www for a main "promo site". I've also set up apache2 to the serve content from the same location to localhost:8080. Under that location I have a folder called beta which contains a Drupal installation that I would like to serve with Apache instead of Nginx.

I've successfully managed to configure Nginx so that requests going to example.com/beta are served by Apache and the files are correctly visible in browser, except for any Drupal related php files. info.php (<?php phpinfo(); ?>) also works. For any of the Drupal related php files I get a standard 500 error.

My config files for both apache and nginx below:

Apache:

<VirtualHost 127.0.0.1:8080>
    ServerAdmin webmaster@localhost

    DocumentRoot /srv/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /srv/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
    AddType application/x-httpd-php .php

    # 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>

Nginx:

server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www;
    index index.html index.php index.htm;

    # Make site accessible from http://localhost/
    server_name example.com;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to index.html
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }

    location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            deny all;
    }

  #THIS BIT IS FOR DRUPAL
    location ~ ^/beta {
            proxy_pass http://127.0.0.1:8080;
            include /etc/nginx/proxy_params;
            index index.php index.html index.htm;
   }
}
share|improve this question
    
wiki.nginx.org/Drupal –  Drew Khoury Apr 30 '13 at 8:12
1  
What's in your Apache's error log for the 500? You call the 500 "standard", but is that an nginx 500 or an Apache 500? –  BMDan May 3 '13 at 15:57
    
It was the Apache 500. Thanks for pointing out the error log, I have no idea why I didn't check that out before! :D From there I found Sun May 05 18:38:01 2013] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected T_STRING in /usr/share/nginx/www/beta/sites/default/settings.php on line 214 It would seem that some of the modifications I did to drupal settings weren't correct! –  jesseniem May 5 '13 at 16:25

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.