当前位置: 博客首页 >> 建站经验 >> 阅读正文

yaf框架在nginx中的vhost配置

作者: 郑晓 分类: 建站经验 发布于: 2017-07-12 17:31 浏览:4,021 没有评论


记录一下我在vagrant+puphpet环境下的yaf框架配置:

server {
listen *:80;
server_name live.dev ;
client_max_body_size 1m;
root /var/www/live/public;
index index.html index.htm index.php;
access_log /var/log/nginx/nxv_4p4tpexsdaaa.access.log;
error_log /var/log/nginx/nxv_4p4tpexsdaaa.error.log;
location ~ \.php$ {
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
location / {
autoindex off;
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?$1 last;
}
}
sendfile off;
}

另一种配置参考:

server {

    listen 80;

    server_name city.test.com;
    root "D:/wwwroot/city/webservice/public";
    index index.php;


    location ~ \.php(.*)$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO  $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
        include        fastcgi_params;
    }
    location / {
        if (!-e $request_filename){
            rewrite ^/(.*)$ /index.php/$1 last;
        }
    }
}
       

本文采用知识共享署名-非商业性使用 3.0 中国大陆许可协议进行许可,转载时请注明出处及相应链接。

本文永久链接: https://www.zh30.com/yaf-nginx-conf.html

发表评论

change vcode