nginx.conf 配置文件新建域名访问

server {
listen 80;
server_name www.huliangqing.com ; //域名地址
charset koi8-r;
access_log logs/huliangqing.log; //这个域名的日志
location / {
root /mnt/www/tplay/public;//共享文件框架的地址
index index.php index.html;//框架的入口文件

if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;//伪静态
break;}

location ~ \.php$ {
root/mnt/www/tplay/public;//也是框架的地址 好像是支持访问php文件
fastcgi_pass 127.0.0.1:9000 ;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

}
}



第二种

server {
  listen 80;
  server_name www.jixie.com;
  root "huliangqing/www/jixie/jixie/public";
  location / {
    index index.php index.html error/index.html;
      if (!-e $request_filename) {
      rewrite ^(.*)$ /index.php?s=/$1 last;
      break;
      }
      # autoindex off;
      }
  location ~ \.php(.*)$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    include fastcgi_params;
    }
}





本地新建域名进行访问

 

 

posted @ 2020-03-26 11:50  胡良庆  阅读(1210)  评论(0编辑  收藏  举报