Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Nginx - When I run a php I get a 404 error or no input file message

$
0
0
I have installed a prestashop in multisite with a server nginx and php-fpm.

With this configuration I can acess web correctly but not to an specific php because I get a 404 error or file no input file message.

I can access to https://domain.es/es/ and to https://domain.es/es/index.php?controller=order but I can't access to https://domain.es/web/modules/paypal/express_checkout/payment.php.

---------------
server {

listen *:80;

listen *:443 ssl;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /var/www/clients/client1/web1/ssl/domain.es.crt;
ssl_certificate_key /var/www/clients/client1/web1/ssl/domain.es.key;

server_name domain.es;

root /var/www/domain.es/web;

index index.html index.htm index.php index.cgi index.pl index.xhtml;

error_log /var/log/ispconfig/httpd/domain.es/error.log;
access_log /var/log/ispconfig/httpd/domain.es/access.log combined;

location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location /stats/ {

index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file /var/www/clients/client1/web1/web/stats/.htpasswd_stats;
}

location ^~ /awstats-icon {
alias /usr/share/awstats/icon;
}

location ~ \.php$ {
try_files /99c11adf1b3f5ca126cf97d4559c1b8f.htm @php;
}
location @php {
# try_files $uri $uri/ /index.php?$args;
# try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_intercept_errors on;
}

location / {
index /index.php;
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2.jpg last;
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3.jpg last;
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite ^/c/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
rewrite ^/c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1.jpg last;
rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
try_files $uri $uri/ /index.php?$args;
}

}
---------------

If I change the settings for the next one, I can acces at website, but on the login page I have not found error. And the other php script it works.

I can't access to https://domain.es/es/index.php?controller=order but I can access to https://domain.es/es/ by writeing index.php and to https://domain.es/web/modules/paypal/express_checkout/payment.php.

----------------
location @php {
# try_files $uri $uri/ /index.php?$args;
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
-----------------

What have I change so I can access to site without this php problems? Have I create a new location or something?

------------------
location @test {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
location /modules/paypal/express_checkout/payment.php {
try_files /99c11adf1b3f5ca126cf97d4559c1b8f.htm @test;
}
------------------

Tanks!

Viewing all articles
Browse latest Browse all 4759

Trending Articles