I am setting up a joomla 3.x site with apache 2.4 on an ubuntu 14.04 server on aws ec2. That alone is fine with url rewrite working fine. I have cleared all apache issues before freeing the port 80 for nginx.
I do not have a particular issue with nginx even though I barely started using it and this is the 3rd deployment with it. I get away with it fine with basic stuff.
I followed a tutorial on howtoforge . After setting up that. I realized only index page loads properly, all other page expect index.php?
in-between domain and the cute urls e.g
stage.domain.com/bla/bla # doesn't work
stage.domain.com/index.php?/bla/bla/ # works
I have seen so many people run into this issue but it's either they host joomla in nginx directly or in apache directly. Solutions of situations close to nginx in front of apache hosting joomla won't work on mine, probably I do not have proper nginx understanding so please bear with me. Below are the configs:
#/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;
}
Below are the proxy_params (though this doesn't reveal real IP, in one of my many trials I could get it. I will have to sort it out after main issue)
#/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;
Below are apache2 ports config
#/etc/apache2/ports.conf
NameVirtualHost *:8000
Listen 8000
#Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
Below is apache virtualhost
<virtualhost *:8000>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin some@domain.com
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>
I would be grateful if someone can point out the misconfiguration. Like mentioned before let to apache alone I do not have url rewrite issue. Thanks.
Update:
Error in the apache2 error log it has nothing to do with 404 in nginx and has the same output when index.php?/ is used:
#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()