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

模板的网站都有哪些内容海珠网站建设方案

模板的网站都有哪些内容,海珠网站建设方案,如何用子域名做网站,濮阳网络电视台第一步:通过Xshell在虚拟机中下载nginx sudo apt-get install nginx 第二步:进入nginx配置页面 cd /etc/nginx 我这里创建了一个html文件夹 在进入去创建页面并且重新加载 boahuboahu-VMware-Virtual-Platform:/$ cd /etc/nginx boahuboahu-VMware-Vir…


第一步:通过Xshell在虚拟机中下载nginx
sudo apt-get install nginx
第二步:进入nginx配置页面
cd /etc/nginx

我这里创建了一个html文件夹 在进入去创建页面并且重新加载

boahu@boahu-VMware-Virtual-Platform:/$ cd /etc/nginx
boahu@boahu-VMware-Virtual-Platform:/etc/nginx$ ls
conf.d        fastcgi_params  koi-utf  mime.types         modules-enabled  proxy_params  sites-available  snippets      win-utf
fastcgi.conf  html            koi-win  modules-available  nginx.conf       scgi_params   sites-enabled    uwsgi_params
boahu@boahu-VMware-Virtual-Platform:/etc/nginx$ cd html/
boahu@boahu-VMware-Virtual-Platform:/etc/nginx/html$ ls
myindex02.html  myindex.html
boahu@boahu-VMware-Virtual-Platform:/etc/nginx/html$ sudo vi myindex03.html
boahu@boahu-VMware-Virtual-Platform:/etc/nginx/html$ ls
myindex02.html  myindex03.html  myindex.html
boahu@boahu-VMware-Virtual-Platform:/etc/nginx/html$ sudo nginx -s reload
2025/06/20 16:15:31 [notice] 14003#14003: signal process started
boahu@boahu-VMware-Virtual-Platform:/etc/nginx/html$ 

第三步配置 conf.d

boahu@boahu-VMware-Virtual-Platform:/etc/nginx/html$ cd ..
boahu@boahu-VMware-Virtual-Platform:/etc/nginx$ ls
conf.d        fastcgi_params  koi-utf  mime.types         modules-enabled  proxy_params  sites-available  snippets      win-utf
fastcgi.conf  html            koi-win  modules-available  nginx.conf       scgi_params   sites-enabled    uwsgi_params
boahu@boahu-VMware-Virtual-Platform:/etc/nginx$ cd conf.d/
boahu@boahu-VMware-Virtual-Platform:/etc/nginx/conf.d$ ls
mynginx.conf
boahu@boahu-VMware-Virtual-Platform:/etc/nginx/conf.d$ 
server {listen 8888;server_name localhost;charset utf-8;location / {root /etc/nginx/html;index myindex.html;}# 修复的精确匹配location = /login/ {alias /etc/nginx/html/;# 方法1: 使用try_filestry_files /myindex02.html =404;# 方法2: 或者使用rewrite# rewrite ^ /myindex02.html last;}# 前缀匹配location ^~ /login/ {root /etc/nginx/html;index myindex03.html;}
}
# 精确匹配
curl http://localhost:8888/login/# 前缀匹配
curl http://localhost:8888/login/test# 根目录
curl http://localhost:8888/

如果访问`/login/test`,Nginx会尝试寻找`/etc/nginx/html/login/test`文件,如果该文件不存在,且没有启用`autoindex`,就会返回404。
修复后

location ^~ /login/ {alias /etc/nginx/html/;try_files /myindex03.html =404;
}

解决方案

修改前缀匹配配置,使用 try_files 指令直接返回目标文件:

server {listen 8888;server_name localhost;charset utf-8;location / {root /etc/nginx/html;index myindex.html;}# 精确匹配/login/ → 返回myindex02.htmllocation = /login/ {alias /etc/nginx/html/;try_files /myindex02.html =404;}# 修复后的前缀匹配location ^~ /login/ {# 方案1:使用alias + try_files(推荐)alias /etc/nginx/html/;try_files /myindex03.html =404;# 方案2:或者使用root + rewrite# root /etc/nginx/html;# rewrite ^/login/.*$ /myindex03.html last;}
}
http://www.dtcms.com/wzjs/829582.html

相关文章:

  • 腾讯云网站备案吗wordpress把相对路径
  • 吉林省建设厅安全证查询网站本地wordpress搬家
  • 免费的网站域名查询方法有哪些网页小游戏在线玩儿
  • 谁会在掏宝网上做网站2014做网站
  • 导航网站模板蓟门桥网站建设
  • 静态网站开发考虑什么连云港企业网站建设公司
  • 用c 可以做网站吗做类似美团的网站得多少钱
  • 黑白灰网站网站如何优化关键词
  • 旅游酒店网站建设背景分析用wordpress招商
  • 手机在线建网站昆明网站seo诊断
  • 简单的网站建设公司的模板去视频网站做编辑器
  • 重庆网站建设 最便宜台州百度推广优化
  • 横沥镇网站建设php装饰公司网站源码
  • 服务器怎么做看视频的网站seo外包公司
  • 建站平台选择建议济南外贸网站制作
  • 在哪几个网站里可以做淘客wordpress批量移动产品
  • 天猫网站做的比京东好营销型建设
  • 网站优化新闻网站开发的工作好做吗
  • 做网站的公司天津佛山有什么网站
  • 做网站月入7000快速网页开发
  • 用护卫神做网站深圳网站设计
  • 十佳网站广州网站建设开发团队
  • 怎么看网站哪个公司做的苏州门户网站有哪些
  • 灵寿网站建设毕业设计做网站怎么做
  • 高端网站建设步骤网站建设選平台
  • 陕西 网站建设首选公司建网站的服务器
  • saas是不是做网站宁波seo外包平台
  • 站长素材官网襄汾县住房和建设局网站
  • 怎么创建收费网站备案中网站名称
  • 周至做网站的公司在那个上面做网站都能搜到