Hi , People
I have many ways , many method to set nginx for work fine with slim.
But right now , I still got error 404.
Please help or suggest me ? sir
Many Thanks.
Pratchaya
######## This is my conf.
server {
# Port 80 will require Nginx to be started with root permissions
# Depending on how you install Nginx to use port 80 you will need
# to start the server with `sudo` ports about 1000 do not require
# root privileges
# listen 80;
listen 80;
server_name api.xxx.work;
root /var/www/site/api/public_html/;
index index.php index.html index.htm;
charset utf-8;
client_max_body_size 100M;
fastcgi_read_timeout 1800;
# Represents the root of the domain
# http://localhost:8000/[index.php]
location / {
# Matches URLS `$_GET['_url']`
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
# When the HTTP request does not match the above
# and the file ends in .php
location ~ [^/]\.php(/|$) {
# try_files $uri =404;
# Ubuntu and PHP7.0-fpm in socket mode
# This path is dependent on the version of PHP install
#fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_pass unix:/run/php-fpm/www.sock;
# Alternatively you use PHP-FPM in TCP mode (Required on Windows)
# You will need to configure FPM to listen on a standard port
# https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/
# fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
# and set php.ini cgi.fix_pathinfo=0
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max; log_not_found off;
access_log off;
}
}
PS. Only index.php ( normal code work fine )