nginx域名配置虚拟主机

一个域名,对应一个IP地址

 

通过DNS域名解析服务器,可以将域名解析为IP地址

这里

通过修改host文件,指定域名的IP地址

host劫持

是指在host文件中,配置域名和IP地址,当访问域名的时候

因为,host文件中已经有了域名所对应的IP地址

所以,不再需要访问DNS服务器进行解析,直接访问对应的IP地址

host文件的位置

C:\Windows\System32\drivers\etc

Nginx配置文件注释:

 [root@localhost conf]# vim nginx.confworker_processes  1;    #worker进程的数量events {                #事件块的开始worker_connections  1024;            #每个worker进程支持的最大连接数}                       #事件块的结束http {                  #HTTP区块的开始include       mime.types;                #Nginx支持媒体类型库文件default_type  application/octet-stream;    #默认的媒体类型sendfile        on;                        #开启高速传输模式keepalive_timeout  65;                     #连接超时server {                                    #第一个server区块的开始    listen       80;                        #提供服务的端口,默认为80    server_name   www.nautilus.org ;                 #提供服务的域名主机    location / {                            #第一个location区块的开始        root   html/www;                        #站点的根目录,相当于Nginx的安装目录        index  index.html index.htm;        #默认的首页文件,多个使用空格隔开    }                                        #第一个location区块的结束    error_page   500 502 503 504  /50x.html;    #出现对应的http状态码是,使用50x.html回应客户    location = /50x.html {                    #location区块的开始,访问50x.html        root   html;                            #指定对应的站点目录为html    }}}                                                   #HTTP区块的结束操作步骤

IPLC专线:International Private Leased Circuit"的缩写,即“国际专线”,是指用户专用的跨国的数据、话音等综合信息业务的通信线路。

[root@localhost nginx]# lsclient_body_temp  fastcgi_temp  logs        sbin       uwsgi_tempconf              html          proxy_temp  scgi_temp[root@localhost nginx]# cd html[root@localhost html]#[root@localhost html]# mkdir www    [root@localhost html]#      [root@localhost html]# cd www[root@localhost www]# lsindex.html[root@localhost www]# vim index.html   hello  localhost[root@localhost nginx]# vim /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6172.31.1.32

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值