我有一個LEMP服務器,我正在尋找安裝RespondCMS(http://respondcms.com/documentation/install-on-digital-ocean)。我遇到了一些API的mod_rewrite部分的一些困難。我已經嘗試了幾次迭代,但一直無法讓它顯示指示PHP應用程序正在工作的「API工作」消息。我得到了404。到目前爲止,我已經在/ etc/nginx/sites-enabled /中設置了以下設置。我在想這不是正確訪問/ api文件夾。理解它如何互動以及如何使其工作的任何幫助,都會受到讚賞。NGINX服務器指令到達API
app.domain.com
server {
listen 80;
server_name app.domain.com;
root /srv/www/domain_app/app;
index index.php index.html index.htm;
access_log /var/log/nginx/respond.access.log;
error_log /var/log/nginx/respond.error.log;
location /api/ {
try_files $uri $uri/ /api/dispatch.php$args;
}
location/{
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /srv/www;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
domain.com
server {
listen 80 default_server;
root /srv/www/html;
index index.php index.html index.htm;
server_name domain.com;
location/{
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
「dispatch.php」的路徑名是什麼? –
這是/srv/www/domain_app/app/api/dispatch.php – daki