Welcome! Log In Create A New Profile

Advanced

alias to work with php.

Posted by gloomen 
alias to work with php.
August 27, 2009 03:25PM
Please help us adjust alias to work with php.
1. There is a site http://xxx.net, upon entering on his PHP scripts are working
2. Ah, so when approaching the http://xxx.net/php, php scripts do not work, nginx/0.7.61 wrote "No input file specified."

[code]
user www;
worker_processes 3;

pid /var/run/nginx.pid;

events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_names_hash_max_size 2048;
server_names_hash_bucket_size 128;

server {
listen 80;
server_name xxx.net;

charset utf8;
client_max_body_size 25m;

location / {
root /usr/local/www/web2/;
index index.html index.php;
}

location /php {
alias /usr/local/www/web3/;
index index.html index.php;
}

location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/web3$fastcgi_script_name;
include fastcgi_params;
}


}


}
[/code]
Re: alias to work with php.
August 27, 2009 03:52PM
Make sure:
1.) All permissions are correct, that means both user:group on the files your working with.
2.) Make sure launch permissions are correct when init-ing php (either spawn or fpm)
3.) Make sure your script_filename path is correct, i like to use (we have a backend, and all this is from memory so don't shoot meh):
fastcgi_param SCRIPT_FILENAME /some/path/to/somewhere/$fastcgi_script_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_pass phpcluster;

These may help, give a whirl!

- Jason
Re: alias to work with php.
August 27, 2009 03:34PM
yeah, why do you have the site mixed into two dirs like that?

you could try adding this block inside of location /php {}

> location ~* \.php$ {
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME /usr/local/www/web3$fastcgi_script_name;
> include fastcgi_params;
> }


it's redundant but might work.




On Thu, Aug 27, 2009 at 12:25 PM, gloomen<nginx-forum@nginx.us> wrote:
>
> Please help us adjust alias to work with php.
> 1. There is a site http://xxx.net, upon entering on his PHP scripts are working
> 2. Ah, so when approaching the http://xxx.net/php, php scripts do not work, nginx/0.7.61 wrote "No input file specified."
>
>
> user  www;
> worker_processes  3;
>
> pid        /var/run/nginx.pid;
>
> events {
>    worker_connections  1024;
> }
> http {
>    include       mime.types;
>    default_type  application/octet-stream;
>    sendfile       on;
>    tcp_nopush     on;
>    tcp_nodelay    on;
>    keepalive_timeout  65;
>    server_names_hash_max_size 2048;
>    server_names_hash_bucket_size 128;
>
>    server {
>        listen       80;
>        server_name  xxx.net;
>
>        charset utf8;
>        client_max_body_size    25m;
>
>        location / {
>                root /usr/local/www/web2/;
>                index index.html index.php;
>        }
>
>        location /php {
>                alias /usr/local/www/web3/;
>                index index.html index.php;
>        }
>
>        location ~* \.php$ {
>            fastcgi_pass   127.0.0.1:9000;
>            fastcgi_index  index.php;
>            fastcgi_param  SCRIPT_FILENAME  /usr/local/www/web3$fastcgi_script_name;
>            include        fastcgi_params;
>        }
>
>
>    }
>
>
> }
>
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?3,5245,5245#msg-5245
>
>
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 159
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