Nginx反向代理服务于Apache的Drupal内容

我是Nginx的新手,但有兴趣尝试一下。

我现在有Nginx监听端口80,并从/ srv / www提供一个主要的“促销网站”的静态HTML内容。 我也设置了apache2到服务内容从相同的位置localhost:8080。 在那个位置下,我有一个名为beta的文件夹,里面包含了一个Drupal的安装,我想用Apache来代替Nginx。

我已经成功地设置Nginx,以便去Apache的服务请求,并在浏览器中正确显示文件,除了任何Drupal相关的PHP文件。 info.php( <?php phpinfo(); ?> )也可以。 对于任何Drupal相关的PHP文件,我得到一个标准的500错误。

我的configuration文件为apache和nginx下面:

阿帕奇:

 <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; } }