nginx.conf 配置文件新建域名访问
Posted 胡良庆
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
}
}
本地新建域名进行访问
以上是关于nginx.conf 配置文件新建域名访问的主要内容,如果未能解决你的问题,请参考以下文章