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

yaf框架在nginx中的vhost配置

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


记录一下我在vagrant+puphpet环境下的yaf框架配置:
<br> server {<br> listen *:80;<br> server_name live.dev ;<br> client_max_body_size 1m;<br> root /var/www/live/public;<br> index index.html index.htm index.php;<br> access_log /var/log/nginx/nxv_4p4tpexsdaaa.access.log;<br> error_log /var/log/nginx/nxv_4p4tpexsdaaa.error.log;<br> location ~ \.php$ {<br> fastcgi_index index.php;<br> include /etc/nginx/fastcgi_params;<br> fastcgi_pass 127.0.0.1:9000;<br> }<br> location / {<br> autoindex off;<br> if (!-e $request_filename) {<br> rewrite ^/(.*) /index.php?$1 last;<br> }<br> }<br> sendfile off;<br> }<br>

另一种配置参考:

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