反向代理问题与nginx通过apache2.4托pipejoomla:重写URL不再工作

我在aws ec2上的ubuntu 14.04服务器上安装了apache 2.4joomla 3.x站点。 这一点很好,与url重写工作正常。 在释放nginx的端口80之前,我清除了所有的apache问题。

我对nginx没有特别的问题,即使我几乎没有开始使用它,这是第三次部署。 我用基本的东西逃脱了。

我跟着howtoforge的教程。 设置完成后 我意识到只索引页面加载正常,所有其他页面期望index.php? 在域名和可爱的url之间

  stage.domain.com/bla/bla # doesn't work stage.domain.com/index.php?/bla/bla/ # works 

我看到有这么多人遇到这个问题,但是他们要么直接在nginx中,要么直接在apache中托pipejoomla。 解决scheme的接近nginx在Apache主机joomla前面将无法正常工作,可能我没有正确的nginx理解,所以请忍受我。 以下是configuration:

 #/etc/nginx/site-enabled/stage.domain.com.vhost server { listen 80; server_name www.stage.domain.com stage.domain.com; root /var/www/html/vhosts/stage.domain.com/htdocs_april; index index.php index.html; location / { try_files $uri @proxy; } location ~* \.(js|css|jpg|jpeg|gif|png|svg|ico|pdf|html|htm)$ { expires 5d; } location @proxy { proxy_pass_header Server; proxy_pass http://127.0.0.1:8000; include /etc/nginx/proxy_params; } location ~* \.php$ { proxy_pass http://127.0.0.1:8000; include /etc/nginx/proxy_params; } 

下面是proxy_params(虽然这并不能揭示真正的知识产权,在我可以得到的许多考验之一中,我将不得不在主要问题之后将其解决)

  #/etc/nginx/proxy_params proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; 

下面是apache2端口configuration

  #/etc/apache2/ports.conf NameVirtualHost *:8000 Listen 8000 #Listen 80 <IfModule ssl_module> Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule> 

下面是apache虚拟主机

 <virtualhost *:8000> # Admin email, Server Name (domain name) and any aliases ServerAdmin [email protected] ServerName stage.domain.com #RewriteEngine On # Index file and Document Root (where the public files are located) DirectoryIndex index.php index.html DocumentRoot /var/www/html/vhosts/stage.domain.com/htdocs_april/ <Directory /var/www/html/vhosts/stage.domain.com/htdocs_april/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> # php_flag log_errors on #php_flag display_errors off #php_value error_reporting 6143 LogLevel warn ErrorLog ${APACHE_LOG_DIR}/domain_error.log CustomLog ${APACHE_LOG_DIR}/domain_access.log combined </virtualhost> 

如果有人能指出错误configuration,我将不胜感激。 就像之前提到的让apache一样,我没有url重写问题。 谢谢。

更新:

在apache2错误日志中出现错误,它与nginx中的404无关,并且在使用index.php?/时具有相同的输出:

  #Info Level [Fri Feb 27 22:51:47.862668 2015] [:error] [pid 12511] [client 127.0.0.1:58301] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /var/www/html/vhosts/stage.domain.com/htdocs_april/templates/stage2013/functions/tpl-init.php on line 313 #Debug Level [Fri Feb 27 22:51:47.977454 2015] [deflate:debug] [pid 12511] mod_deflate.c(849): [client 127.0.0.1:58301] AH01384: Zlib: Compressed 49347 to 11157 : URL /index.php [Fri Feb 27 22:51:47.977925 2015] [headers:debug] [pid 12511] mod_headers.c(845): AH01502: headers: ap_headers_output_filter() [Fri Feb 27 22:51:48.606561 2015] [authz_core:debug] [pid 12512] mod_authz_core.c(802): [client 127.0.0.1:58304] AH01626: authorization result of Require all granted: granted, referer: http://stage.domain.com/ [Fri Feb 27 22:51:48.606593 2015] [authz_core:debug] [pid 12512] mod_authz_core.c(802): [client 127.0.0.1:58304] AH01626: authorization result of <RequireAny>: granted, referer: http://stage.domain.com/ [Fri Feb 27 22:51:48.607274 2015] [deflate:debug] [pid 12512] mod_deflate.c(849): [client 127.0.0.1:58304] AH01384: Zlib: Compressed 1537 to 544 : URL /templates/stage2013/html/mod_fpss/stage5/css/template.css.php, referer: http://stage.domain.com/ [Fri Feb 27 22:51:48.607293 2015] [headers:debug] [pid 12512] mod_headers.c(845): AH01502: headers: ap_headers_output_filter()