Sunday, 15 June 2014

php - serve multiple directories in ngnix -



php - serve multiple directories in ngnix -

i trying setup ngnix on vps serve different stuff e.g

examplesite.com/ (main site)

examplesite.com/pro/ (sub app)

examplesite.com/ad/

i wanted able run different php apps these directories.

my first task examplesite.com/pro site working having problems.

please help me ?

i want able run different things. trying install prosper202 on /pro/ directory.

my default.conf file :

server { hear 80; server_name .exmaple.com; root /usr/share/nginx/html; client_max_body_size 512m; # default location settings location / { index index.php; } location /pro { index index.php; try_files $uri $uri/ pro/index.php?$args; } # redirect server error pages static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # pass php scripts fastcgi server (locally unix: param avoid network overhead) location ~ \.php$ { # prevent zero-day exploit try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; #note: should have "cgi.fix_pathinfo = 0;" in php.ini fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; } ---------------------------ngnix.conf------------------------------------- user nginx; worker_processes 4; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; }

my error.log file :

2014/11/06 11:51:41 [error] 3152#0: *1 directory index of "/usr/share/nginx/html/" forbidden, client: 14.16.105.135, server: , request: "get / http/1.1", host: "ip" 2014/11/06 11:54:39 [error] 3218#0: *1 directory index of "/usr/share/nginx/html/" forbidden, client: 14.176.105.135, server: , request: "get / http/1.1", host: "ip"

there's slash missing in try_files directive.

replace :

pro/index.php?$args

with :

/pro/index.php$is_args$args.

php nginx

No comments:

Post a Comment