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:


    ServerAdmin webmaster@localhost

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

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

    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 ::1/128



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;
            deny all;

    location ~ ^/beta {
            include /etc/nginx/proxy_params;
            index index.php index.html index.htm;
  • 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] 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.