自己学习,记录下来,仅供参考,高手就跳过吧
第一步:
sudo vim /etc/hosts
127.0.0.1 localhost
127.0.1.1 allen
#本地调试用的
127.0.0.1 www.example.com(你想要的域名)
# The following lines are desirable for IPv6 capablehosts
::1 ip6-localhostip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
sudo /etc/init.d/networking restart
第二步:
首先 看看我的nginx配置
user allen allen;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
pid logs/nginx.pid;
events {
}
http {
}
如下 example.conf
server {
这样设置就是我把本地typecho应用的域名设置www.example.com
转自:http://blog.youkuaiyun.com/shujuliu818/article/details/47065917
转自:http://blog.youkuaiyun.com/shujuliu818/article/details/47065917
本文介绍如何通过编辑/etc/hosts文件将域名映射到本地,并配置Nginx以实现本地环境下的域名访问。首先修改hosts文件添加所需域名,然后重启网络服务;接着配置Nginx虚拟主机,设置域名监听及根目录。
7750





