Welcome! Log In Create A New Profile

Advanced

php files 404 error, nginx with apache.

Posted by drmetal 
php files 404 error, nginx with apache.
June 25, 2011 01:23PM
I have a kloxo installation, and I want to install nginx as a reverse proxy to apache.

Apache is already running on port 80 without any problem (and the php files are working great) and now I am trying to install nginx on port 81 and test if everything is working ok, then switch ports.

Static files are working great, but whenever I click on a .php link, I get a 404 error file does not exist, from apache.

I am already passing the host header (proxy_set_header Host $host;), and i can't thing of anything else, why this isn't working.

The name server_name domain.gr www.domain.gr; is the same as the apache virtual host file.

The error i get is: The requested URL /link.php was not found on this server.

The nginx configuration is:
------------------------------------
server {
limit_conn myzone 10;
listen 88.80.13.40:81;
server_name domain.gr www.domain.gr;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /home/admin/domain.gr;
index index.html index.htm index.php;
}

error_page 404 /404.html;

location = /404.html {
root /usr/share/nginx/html;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

#proxy the PHP scripts to Apache listening on 127.0.0.1:80

location ~ \.php$ {

proxy_pass http://127.0.0.1;
proxy_pass_header Set-Cookie;
proxy_set_header Host $host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


}
location ~ /\.ht {
deny all;
}
}

----------------------------------

Apache virtual host file:

-------------------
<VirtualHost \
88.80.13.40:80\
>
servername domain.gr
ServerAlias www.domain.gr
DocumentRoot /home/admin/domain.gr/
DirectoryIndex index.php index.html index.shtml index.htm default.htm Default.aspx Default.asp index.pl
ScriptAlias /awstats/ /home/kloxo/httpd/awstats/wwwroot/cgi-bin/
<IfModule suexec.c>
SuexecUserGroup admin admin
</IfModule>


<IfModule mod_suphp.c>
AddType application/x-httpd-php .php
RemoveHandler .php
<FilesMatch "\.php$" >
SetHandler x-httpd-php
</FilesMatch>
<Location />
suPHP_AddHandler x-httpd-php
</Location>
SuPhp_UserGroup admin admin
</IfModule>


Alias /stats /home/httpd/domain.gr/webstats/
Alias /__kloxo /home/admin/kloxoscript
Redirect /kloxononssl http://cp.domain.gr:7778
Redirect /kloxo https://cp.domain.gr:7777
Redirect /webmail https://webmail.domain.gr
<Directory /home/httpd/domain.gr/kloxoscript>
AllowOverride All
</Directory>


<IfModule mod_php5.c>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@domain.gr"
</IfModule>

ScriptAlias /cgi-bin/ /home/admin/domain.gr//cgi-bin/
CustomLog /home/httpd/domain.gr/stats/domain.gr-custom_log combined
ErrorLog /home/httpd/domain.gr/stats/domain.gr-error_log
--------------------

That is the first line, it's really big i don't thing the rest is important.

I replaced the actual domain with domain.gr for obvious reasons, so the error is not related to that.

I can see anything wrong. I nginx and request the .php file in the browser and I see the 404 error. This is only for .php files and nothing else.

Can someone help me with this ? Do you see anything wrong ?

Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready