mac MAMP nginx 多站点配置

1. 打开 /Applications/MAMP/conf/nginx/nginx.conf 在http最后面 加上一行

 

  include vhost/nginx.*.conf;  这是加载vhost文件夹里面的所有nginx.(站点).conf 的配置文件

2.在vhost文件 新建文件

  在nginx目录下建立vhost目录

  如 配置 www.sign.com 那就在vhost新建nginx.sign.conf

  在文件中添加以下内容

  

server {
        listen               80;
        server_name          www.sign.com;
        # MAMP DOCUMENT_ROOT !! Don't remove this line !!
        root                 "/Applications/MAMP/htdocs/sign/public";

        access_log           /Applications/MAMP/logs/sign_access.log;
        error_log            /Applications/MAMP/logs/sign_error.log debug;

        location / {
            index            index.html index.php;
        }
     #下面这块最好复制nginx.conf文件里面的,如果地址和我的不一样,php代码会解析不了 这行不能复制进去会启动不了nginx
        location ~ \.php$ {
                    try_files        $uri =404;
                    fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock; 
                    fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include          fastcgi_params;
        }
}

 

   

posted @ 2021-04-15 16:48  时间掉飞机  阅读(802)  评论(0编辑  收藏  举报