当前位置: 首页 > news >正文

学网站开发推荐书分类达人的作用

学网站开发推荐书,分类达人的作用,沪上装修排名前十有哪些品牌,优衣库网站建设【0】README#xff1a; nginx 可以配置多种类型的虚拟主机#xff1a; 类型1#xff09; 基于ip的虚拟主机#xff1b; 类型2#xff09;基于域名的虚拟主机#xff1b; 类型3#xff09;基于端口的虚拟主机#xff1b; 【1】配置基于 ip 的虚拟主机的准备工作 …【0】README nginx 可以配置多种类型的虚拟主机  类型1 基于ip的虚拟主机 类型2基于域名的虚拟主机 类型3基于端口的虚拟主机 【1】配置基于 ip 的虚拟主机的准备工作 step1 先用 ifconfig 查看该服务器的ip地址   本服务器有一块物理网卡设备 eth0 和 本地回环设备lo eth0 的ip地址为 192.168.186.100 本地回环lo的ip地址为 127.0.0.1 eth0 Link encap:Ethernet HWaddr 00:0C:29:71:D7:1A inet addr:192.168.186.100 Bcast:192.168.186.255 Mask:255.255.255.0inet6 addr: fe80::20c:29ff:fe71:d71a/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:1349 errors:0 dropped:0 overruns:0 frame:0TX packets:1155 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:139966 (136.6 KiB) TX bytes:145180 (141.7 KiB)Interrupt:19 Base address:0x2000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0inet6 addr: ::1/128 Scope:HostUP LOOPBACK RUNNING MTU:16436 Metric:1RX packets:4 errors:0 dropped:0 overruns:0 frame:0TX packets:4 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0 RX bytes:240 (240.0 b) TX bytes:240 (240.0 b) step2  在 eth0 网卡设备上 添加两个ip别名 192.168.186.101 和 192.168.186.102可以通过以下的 ifconfig 和 route命令来进行 [rootlocalhost nginx]# ifconfig eth0:1 192.168.186.101 broadcast 192.168.186.255 netmask 255.255.255.0 up [rootlocalhost nginx]# route add -host 192.168.186.101 dev eth0:1 [rootlocalhost nginx]# [rootlocalhost nginx]# ifconfig eth0:2 192.168.186.102 broadcast 192.168.186.255 netmask 255.255.255.0 up [rootlocalhost nginx]# route add -host 192.168.186.102 dev eth0:2 step3再执行 ifconfig命令就可以看到 eth0 网卡设备上绑定两个 ip 别名如下所示 [pacosonlocalhost ~]$ ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:71:D7:1A inet addr:192.168.186.100 Bcast:192.168.186.255 Mask:255.255.255.0inet6 addr: fe80::20c:29ff:fe71:d71a/64 Scope:LinkUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1RX packets:1349 errors:0 dropped:0 overruns:0 frame:0TX packets:1155 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:139966 (136.6 KiB) TX bytes:145180 (141.7 KiB)Interrupt:19 Base address:0x2000 eth0:1 Link encap:Ethernet HWaddr 00:0C:29:71:D7:1A inet addr:192.168.186.101 Bcast:192.168.186.255 Mask:255.255.255.0UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1Interrupt:19 Base address:0x2000 eth0:2 Link encap:Ethernet HWaddr 00:0C:29:71:D7:1A inet addr:192.168.186.102 Bcast:192.168.186.255 Mask:255.255.255.0UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1Interrupt:19 Base address:0x2000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0inet6 addr: ::1/128 Scope:HostUP LOOPBACK RUNNING MTU:16436 Metric:1RX packets:4 errors:0 dropped:0 overruns:0 frame:0TX packets:4 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0 RX bytes:240 (240.0 b) TX bytes:240 (240.0 b) step4ping 通 证明配置无误 [pacosonlocalhost ~]$ ping 192.168.186.101 PING 192.168.186.101 (192.168.186.101) 56(84) bytes of data. 64 bytes from 192.168.186.101: icmp_seq1 ttl64 time4.35 ms 64 bytes from 192.168.186.101: icmp_seq2 ttl64 time0.149 ms 64 bytes from 192.168.186.101: icmp_seq3 ttl64 time0.073 ms 64 bytes from 192.168.186.101: icmp_seq4 ttl64 time0.065 ms 64 bytes from 192.168.186.101: icmp_seq5 ttl64 time0.063 ms 64 bytes from 192.168.186.101: icmp_seq6 ttl64 time0.066 ms 64 bytes from 192.168.186.101: icmp_seq7 ttl64 time0.070 ms 64 bytes from 192.168.186.101: icmp_seq8 ttl64 time0.069 ms ^C --- 192.168.186.101 ping statistics --- 8 packets transmitted, 8 received, 0% packet loss, time 7915ms rtt min/avg/max/mdev 0.063/0.613/4.352/1.413 ms [pacosonlocalhost ~]$ [pacosonlocalhost ~]$ [pacosonlocalhost ~]$ ping 192.168.186.102 PING 192.168.186.102 (192.168.186.102) 56(84) bytes of data. 64 bytes from 192.168.186.102: icmp_seq1 ttl64 time9.36 ms 64 bytes from 192.168.186.102: icmp_seq2 ttl64 time0.212 ms 64 bytes from 192.168.186.102: icmp_seq3 ttl64 time0.065 ms 64 bytes from 192.168.186.102: icmp_seq4 ttl64 time0.063 ms 64 bytes from 192.168.186.102: icmp_seq5 ttl64 time0.064 ms 64 bytes from 192.168.186.102: icmp_seq6 ttl64 time0.063 ms 64 bytes from 192.168.186.102: icmp_seq7 ttl64 time0.063 ms 64 bytes from 192.168.186.102: icmp_seq8 ttl64 time0.077 ms 64 bytes from 192.168.186.102: icmp_seq9 ttl64 time0.062 ms ^C --- 192.168.186.102 ping statistics --- 9 packets transmitted, 9 received, 0% packet loss, time 8993ms rtt min/avg/max/mdev 0.062/1.115/9.366/2.917 ms 【注意】ifconfig 和 route 配置的ip别名在服务器重启后会消失可以将 ifconfig 和 route 命令添加到 /etc/rc.local 文件中 让系统开机时自动运行 以下是相关命令 vim /etc/rc.local 在末尾增加以下内容  ifconfig eth0:1 192.168.186.101 broadcast 192.168.186.255 netmask 255.255.255.0 up route add -host 192.168.186.101 dev eth0:1 ifconfig eth0:2 192.168.186.102 broadcast 192.168.186.255 netmask 255.255.255.0 up route add -host 192.168.186.102 dev eth0:2 【2】配置基于ip的虚拟主机 1配置文件 nginx.conf 如下 # this config is from 3-6 worker_processes 3; events {worker_connections 1024; } http {# first virtual host 第一个虚拟主机server{# ip and port monitored 监听的ip和端口listen 192.168.186.100:80;# host name 主机名称server_name 192.168.186.100;# the dir access_log saved 访问日志文件存放路径access_log logs/server1.access.log combined;location /{# default index file, priority reduction from left to right# 默认首页文件顺序从左到右index index.html index.htm;# the dir html file saved html网页文件存放目录root /data0/htdocs/server1;}}# second virtual hostserver{listen 192.168.186.101:80;server_name 192.168.186.101;access_log logs/server2.access.log combined;location /{index index.html index.htm;root /data0/htdocs/server2;}}# third virtual hostserver {listen 192.168.186.102:80;server_name 192.168.186.102;access_log logs/server3.access.log combined;location /{index index.html index.htm;root /data0/htdocs/server3.com;}} }【3】配置基于域名的虚拟主机 1nginx配置文件如下 http {# 第一个虚拟主机server{# 监听的端口listen 80;# 主机名称server_name aaa.domain.com;# 访问日志文件存放路径access_log logs/aaa.domain.com.access.log combined;location /{# 默认首页文件顺序从左到右如果找不到index.html文件则查找index.htm文件作为首页文件index index.html index.htm;# HTML网页文件存放的目录root /data0/htdocs/aaa.domain.com;}}# 第二个虚拟主机server{# 监听的IP和端口listen 80;# 主机名称server_name bbb.otherdomain.com;# 访问日志文件存放路径access_log logs/bbb.otherdomain.com.access.log combined;location /{# 默认首页文件顺序从左到右如果找不到index.html文件则查找index.htm文件作为首页文件index index.html index.htm;# HTML网页文件存放的目录root /data0/htdocs/bbb.otherdomain.com;}}# 第三个虚拟主机server{# 监听的IP和端口listen 80;# 主机名称server_name www.domain.com domain.com *.domain.com;# 访问日志文件存放路径access_log logs/bbb.domain.com.access.log combined;location /{# 默认首页文件顺序从左到右如果找不到index.html文件则查找index.htm文件作为首页文件index index.html index.htm;# HTML网页文件存放的目录root /data0/htdocs/domain.com;}} }
http://www.yutouwan.com/news/330952/

相关文章:

  • 怎样建设游戏网站南通营销平台网站建设
  • 电子商务网站建设运行环境南平网站怎么做seo
  • 临沂网站优化公司网页建设推荐
  • 腾冲市住房和城乡建设局网站免费网站注册com
  • 网站开发项目时序图安阳安强网络科技有限公司
  • 网站建设服务费怎么做会计分录网站跳转qq链接怎么做的
  • 湖南建设人力资源网官网林西网站建设优化
  • 北京建网站实力公司wordpress wp_video_shortcode
  • 临沂seo整站优化厂家申请注册一个商标多少钱
  • 如何运营垂直网站做一网站要什么
  • 爱站网关键词搜索工具服务好的南昌网站建设
  • 免费域名怎么做网站手机网站如何开通微信公众号
  • 中国企业建设网站网站评论管理怎么做的
  • 红色扁平化网站网站维护托管
  • 游戏点卡平台网站开发深圳有几个区2022
  • 贵阳做网站云南网站建
  • 农村自建房设计图纸龙华优化公司
  • 江津网站建设怎么重新安装我的wordpress
  • flash网站效果平顶山高端网站建设
  • 成都专业网站排名推广网站建设的主题
  • 网站项目案例安微省建设厅网站
  • 工商局加强网站建设的通知工程建设云
  • 吉林企业建站系统费用哪些企业网站做的好
  • 互联网产品开发seo优化自动点击软件
  • 如何做网站美工的建设上海网站
  • 网站页面构成要素用模板建商场购物网站
  • 佛山网站建设公司哪家便宜装饰设计师工作内容
  • 免费推广网站企业法治建设工作报告
  • 高端网站开发建设下载企业微信最新版
  • 网站内页做药品的电商网站有哪些