当前位置:   article > 正文

ubuntu 在本地设置域名_ubuntu 本地域名

ubuntu 本地域名
自己学习,记录下来,仅供参考,高手就跳过吧
第一步:
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 {
    worker_connections  1024;
}
http {
    include      mime.types;
    default_type  application/octet-stream;
    log_format  main   '$remote_addr -$remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent"$http_referer" '
                      '"$http_user_agent""$http_x_forwarded_for"';
    access_log  logs/access.log   main;
    sendfile        on;
    #tcp_nopush    on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    gzip  on;
    //虚拟主机的配置,这样vhosts文件夹包含一个个文件,每一个文件都是一个站点
    include vhosts/*;
}
如下 example.conf
server {
        listen       80;
        server_name  www.example.com;
        location / {
        root     /data/www/wwwroot/typecho/;
            indexindex.php   index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root  html;
        }

        location ~ \.php* {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index   index.php;
            fastcgi_param   SCRIPT_FILENAME  /data/www/wwwroot/typecho$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
这样设置就是我把本地typecho应用的域名设置www.example.com

转自:http://blog.csdn.net/shujuliu818/article/details/47065917
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/579878
推荐阅读
相关标签
  

闽ICP备14008679号