Linux下nginx 配置本地域名


1、 /etc/hosts   文件添加:127.0.0.1   baidu.dev

2、/usr/local/nginx/conf/vhost/A.conf    

插入内容:

 1 server {
 2     listen 80;
 3     server_name baidu.dev;
 4     root /home/wwwroot/default/baidu/public;
 5 
 6     index index.html index.htm index.php;
 7 
 8     charset utf-8;
 9 
10     location / {
11         try_files $uri $uri/ /index.php?$query_string;
12     }
13 
14     location = /favicon.ico { access_log off; log_not_found off; }
15     location = /robots.txt  { access_log off; log_not_found off; }
16 
17     #error_page 404 /index.php;
18     access_log  /home/wwwlogs/access.log;
19 
20     sendfile off;
21 
22     client_max_body_size 100m;
23 
24     include fastcgi.conf;
25 
26     location ~ /\.ht {
27         deny all;
28     }
29     location ~ [^/]\.php(/|$)
30     {
31         try_files $uri =404;
32         fastcgi_pass  unix:/tmp/php-cgi.sock;
33         fastcgi_index index.php;
34         include fastcgi.conf;
35         fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/../:/tmp/:/proc/";
36     }
37 }

 

3、重启nginx:

service nginx restart


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM