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
總結
以上是生活随笔為你收集整理的nginx域名配置虚拟主机的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一年级数学题,照片求解答
- 下一篇: 抛物线y=ax²bxc与x轴相交于a(2