随笔 - 137  文章 - 1  评论 - 3  阅读 - 14万 
复制代码
nginx的基本配置文件如下

server {
    listen 80;
    server_name www.mydoman.com;
    root /www/web/project;  # 确保这里指向的目录正确 是项目在系统的路径
    index index.php;
    access_log /www/log/nginx_log/www.mydoman.com/access.log ;
    

     # 处理静态资源文件(如 .txt、.jpg 等)
    location ~* \.(txt|jpg|jpeg|png|gif|css|js|ico|html|json|xml)$ {
        try_files $uri $uri/ =404;  # 如果文件存在,返回文件;否则返回 404 错误
    }

    # 默认页面:如果请求的文件或目录不存在,则转发给 index.php
    location / {
        try_files $uri $uri/ /index.php?$args;
    }


    # 处理 PHP 文件

    
    location ~ \.php$ {
        fastcgi_pass 172.17.0.2:9000;  # PHP 容器的 IP 地址和端口
        fastcgi_param SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;  # 这里指向的是宿主机路径  docker里面的路径
        fastcgi_index index.php;
        include fastcgi_params;
    }
}
复制代码

 

posted on   ヽ坚强的蘑菇  阅读(6)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示