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

如何通过域名访问网站做网站要有策划么

如何通过域名访问网站,做网站要有策划么,网络推广深圳有效渠道,网站规划的案例一.静态页面 1.更改页面内容 2.更改配置文件 3.测试 二.虚拟主机配置 1.基于IP #xff08;1#xff09;在html目录下新建目录存放测试文件 #xff08;2#xff09;修改nginx.conf文件#xff0c;在htttp模块中配置两个server模块分别对应两个IP #xff08;31在html目录下新建目录存放测试文件 2修改nginx.conf文件在htttp模块中配置两个server模块分别对应两个IP 3测试 2.基于端口 1创建测试界面 2同样在http模块中添加server模块注意工作目录的变动 3测试 3.基于域名 1在前面基于IP的基础上添加server_name一行即可 2修改/etc/hosts文件 3测试 三.nginx错误日志和访问日志配置 1. 在server模块中指定日志类型和日志存放目录即可 2.测试两边后查看 一.静态页面 要关闭apache的httpd [rootlocalhost conf]# systemctl status httpd.service ● httpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)Active: inactive (dead)Docs: man:httpd(8)man:apachectl(8) 1.更改页面内容 找到自己的nginx安装目录里的html目录修改index.html [rootlocalhost html]# pwd /usr/local/src/nginx-1.22.0/html [rootlocalhost html]# cat index.html h1nginx/h12.更改配置文件 nginx安装目录里的nginx.conf文件 [rootlocalhost conf]# pwd /usr/local/src/nginx-1.22.0/conf [rootlocalhost conf]# vim nginx.conf 找到serve内的区块位置更改工作目录和指定html文件  server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root /usr/local/src/nginx-1.22.0/html; #你的html文件存放目录index index.html; #如果前面页面文件是其它名字这里要更改一致}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location /50x.html {root html;} } [rootlocalhost conf]# systemctl restart nginx 3.测试 二.虚拟主机配置 1.基于IP 1在html目录下新建目录存放测试文件 [rootlocalhost html]# ll total 8 -rw-r--r-- 1 1001 1001 497 May 24 2022 50x.html -rw-r--r-- 1 1001 1001 15 Aug 10 10:13 index.html drwxr-xr-x 2 root root 43 Aug 10 11:53 ip drwxr-xr-x 2 root root 6 Aug 10 11:51 port [rootlocalhost html]# pwd /usr/local/src/nginx-1.22.0/html [rootlocalhost html]# cat ip/index.html ip/index1.html 190 195 2修改nginx.conf文件在htttp模块中配置两个server模块分别对应两个IP server {listen 192.168.2.190;location / {root /usr/local/src/nginx-1.22.0/html/ip;index index.html index.htm;}}server {listen 192.168.2.195;location / {root /usr/local/src/nginx-1.22.0/html/ip;index index1.html index.htm;}} [rootlocalhost conf]# systemctl restart nginx 3测试 2.基于端口 1创建测试界面 [rootlocalhost html]# cat port/index.html port/index1.html 8090 80992同样在http模块中添加server模块注意工作目录的变动 server {listen 8090;location / {root /usr/local/src/nginx-1.22.0/html/port;index index.html index.htm;}}server {listen 8099;location / {root /usr/local/src/nginx-1.22.0/html/port;index index1.html index.htm;}} [rootlocalhost conf]# systemctl restart nginx 3测试 3.基于域名 1在前面基于IP的基础上添加server_name一行即可 server {listen 192.168.2.190;server_name www.aabb.com;location / {root /usr/local/src/nginx-1.22.0/html/ip;index index.html index.htm;}}server {listen 192.168.2.195;server_name www.llss.com;location / {root /usr/local/src/nginx-1.22.0/html/ip;index index1.html index.htm;}} [rootlocalhost conf]# systemctl restart nginx 2修改/etc/hosts文件 Linux [rootlocalhost conf]# vim /etc/hosts 192.168.2.190 www.aabb.com 192.168.2.195 www.llss.comwindows 通过powershell使用notepad修改hosts文件 Windows PowerShell 版权所有C Microsoft Corporation。保留所有权利。安装最新的 PowerShell了解新功能和改进https://aka.ms/PSWindowsPS C:\WINDOWS\system32 cd .\drivers\etc\PS C:\WINDOWS\system32\drivers\etc notepad .\hosts PS C:\WINDOWS\system32\drivers\etc 3测试 三.nginx错误日志和访问日志配置 1. 在server模块中指定日志类型和日志存放目录即可 2.测试两边后查看 [rootlocalhost logs]# cat access.log 192.168.2.2 - - [10/Aug/2023:14:06:00 0800] GET / HTTP/1.1 304 0 - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.200 192.168.2.2 - - [10/Aug/2023:14:06:00 0800] GET /favicon.ico HTTP/1.1 404 555 http://192.168.2.190/ Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.200 [rootlocalhost logs]# cat error.log 2023/08/10 14:06:00 [error] 59751#59751: *1 open() /usr/local/src/nginx-1.22.0/html/ip/favicon.ico failed (2: No such file or directory), client: 192.168.2.2, server: www.aabb.com, request: GET /favicon.ico HTTP/1.1, host: 192.168.2.190, referrer: http://192.168.2.190/ [rootlocalhost logs]# pwd /usr/local/src/nginx-1.22.0/logs
http://www.w-s-a.com/news/926044/

相关文章:

  • 开源 网站开发框架哪些网站可以做图片链接
  • 大良制作网站网站设计的能力要求
  • 前端设计除了做网站还能做什么江苏高校品牌专业建设工程网站
  • 做二手房产网站多少钱用户权限配置wordpress
  • 做亚马逊网站需要租办公室吗小型企业网站模板
  • 网站全屏视频怎么做个人公司注册网上申请
  • 如何k掉别人的网站搜索引擎优化与关键词的关系
  • 百度推广 网站吸引力做网站开发的薪酬怎么样
  • js网站开发工具软件营销方案
  • 做网站的天空网云南省建设厅网站怎么进不去
  • 天津网站排名提升网络营销推广策略包括哪些
  • 网站建设与管理 ppt网站打开是别人的
  • 图片网站怎么做排名怎么分析一个网站seo
  • 伪原创对网站的影响深圳装修公司排名100强
  • 网站建设公司效果个人可以做医疗信息网站吗
  • 网站使用arial字体下载微网站 建设
  • 文化馆网站建设意义营销型国外网站
  • 公司网站定位建议wordpress怎么用模板
  • 中国十大热门网站排名计算机选什么专业最好
  • 怀化建设企业网站太原网站关键词排名
  • 空间注册网站网站制作是怎么做的
  • 数码家电商城网站源码一个网站的成本
  • 网站伪静态是什么意思麻涌东莞网站建设
  • 理县网站建设公司郑州仿站定制模板建站
  • 手机网站建设网站报价诸城人才网招聘网
  • 一起做网站怎么下单临沂网站制作
  • 公司网站案例企业网站 模版
  • 做的好的响应式网站有哪些网站界面设计案例
  • 上海创意型网站建设icp备案网站信息
  • 网站没收录中山手机网站制作哪家好