windows下wnmp配置

windows下面apache结合laravel会出现env文件公用的问题,太麻烦,就换用nginx。问题:https://github.com/vlucas/phpdotenv/issues/219

1.我直接下载openresty的windows版本,启动

2.进入到php目录:php-cgi.exe -b 127.0.0.1:9000

3.openresty的conf文件夹,nginx.conf文件增加include vhosts/*.conf ,vhosts文件配置如下:

server {
    listen 80;
    server_name ac1.api.axd.com;
    root D:webservicephpgitlab.aixiangdao.comac1.apipublic;
    index index.html index.htm index.php;
   
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";


    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }


    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    #error_page 404 /index.php;

    location ~ .php$ {
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        #fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /.(?!well-known).* {
        deny all;
    }
}

原文地址:https://www.cnblogs.com/mentalidade/p/9708889.html