nginx Server服務配置說明


配置Demo

server {
    server_name  adminapi-local.activity.com;
	root D:\WWW\project\activity-api\public;
    index index.php index.html;
    access_log /data/log/nginx/lottery-$host.log;
    location / {
        if (!-e $request_filename) {
            rewrite ^(.*)$ /admin.php?pathinfo=$1 last;
            break;
        }
    }
    location ~ \.php(.*)$ {
        fastcgi_pass   127.0.0.1:9000;
        include        fastcgi.conf;
        fastcgi_param LOTTERY_ENV dev;
    }
}

路由到項目根目錄時的處理

location / {

}

請求網站下PHP文件的時候,反向代理到cgi

location ~ .php(.*)$ {

}
https://blog.csdn.net/zjuwangleicn/article/details/79300347

當訪問的文件和目錄不存在時,重定向到某個php文件

if( !-e $request_filename )
{
rewrite ^/(.*)$ index.php last;
}

https://www.linuxidc.com/Linux/2014-01/95493.htm

服務配置指令
listen 80 監聽端口
server_name www.test.com 主機host
root /data/html 根目錄
index index.php index.html 首頁
location / {} 根目錄路由


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM