當(dāng)前位置: 博客首頁 >> 建站經(jīng)驗(yàn) >> 閱讀正文

yaf框架在nginx中的vhost配置

作者: 鄭曉 分類: 建站經(jīng)驗(yàn) 發(fā)布于: 2017-07-12 17:31 瀏覽:3,990 沒有評(píng)論


記錄一下我在vagrant+puphpet環(huán)境下的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;
        }
    }
}
? ? ? ?

本文采用知識(shí)共享署名-非商業(yè)性使用 3.0 中國大陸許可協(xié)議進(jìn)行許可,轉(zhuǎn)載時(shí)請注明出處及相應(yīng)鏈接。

本文永久鏈接: http://m.yjfs.org.cn/yaf-nginx-conf.html

發(fā)表評(píng)論

change vcode