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

苏州艺术家网站建设合肥网站建设公司

苏州艺术家网站建设,合肥网站建设公司,查pv uv的网站,化妆品网站建设的设计思路👨‍🎓博主简介 🏅CSDN博客专家   🏅云计算领域优质创作者   🏅华为云开发者社区专家博主   🏅阿里云开发者社区专家博主 💊交流社区:运维交流社区 欢迎大家的加入&#xff01…

👨‍🎓博主简介

  🏅CSDN博客专家
  🏅云计算领域优质创作者
  🏅华为云开发者社区专家博主
  🏅阿里云开发者社区专家博主
💊交流社区:运维交流社区 欢迎大家的加入!
🐋 希望大家多多支持,我们一起进步!😄
🎉如果文章对你有帮助的话,欢迎 点赞 👍🏻 评论 💬 收藏 ⭐️ 加关注+💗


文章目录

  • 一个域名带https配置多个项目
  • 一个域名配置多个项目
  • 本机地址配置多个项目
  • 相关文章
  • 相关专栏

在这里插入图片描述

一个域名带https配置多个项目

①、首先将项目移动到html下;
②、将ssl证书移动到目的地;
③、然后进行nginx配置;

Nginx配置文件完整代码展示(主要在server段):


#user  root;
worker_processes 1;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;sendfile on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout 65;#gzip  on;server {listen 80;server_name test.top www.test.top;# HTTP 重定向到 HTTPSreturn 301 https://$host$request_uri;}server {listen 443 ssl;server_name test.top www.test.top;# SSL 配置ssl_certificate /usr/local/nginx/conf/ssl/test.top.pem;ssl_certificate_key /usr/local/nginx/conf/ssl/test.top.key;ssl_protocols TLSv1.2 TLSv1.3;ssl_ciphers 'TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256';ssl_prefer_server_ciphers on;# 设置错误页面error_page 404 /404.html;error_page 500 /500.html;location = /404.html {root /usr/local/nginx/html;internal;}location = /500.html {root /usr/local/nginx/html;internal;}# 定义项目根目录root /usr/local/nginx/html;# 默认访问 项目1 【如果不想用项目1,也可以自定义其他项目】location / {try_files $uri $uri/ /项目1/index.html;#			root   html;#			index  index.html index.htm;}# 项目1 项目location /项目1 {alias /usr/local/nginx/html/项目1;try_files $uri $uri/ /项目1/index.html;}# 项目2 项目location /项目2 {alias /usr/local/nginx/html/项目2;try_files $uri $uri/ /项目2/index.html;}# 项目3 项目location /项目3 {alias /usr/local/nginx/html/项目3;try_files $uri $uri/ /项目3/index.html;}}
}

这样页面访问时就可以是:https://test.top/项目1/https://test.top/项目2/https://test.top/项目3/

一个域名配置多个项目

①、首先将项目移动到html下;
②、然后进行nginx配置;

Nginx配置文件完整代码展示(主要在server段):


#user  root;
worker_processes 1;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;sendfile on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout 65;#gzip  on;server {listen 80;server_name test.top www.test.top;# 设置错误页面error_page 404 /404.html;error_page 500 /500.html;location = /404.html {root /usr/local/nginx/html;internal;}location = /500.html {root /usr/local/nginx/html;internal;}# 定义项目根目录root /usr/local/nginx/html;# 默认访问 项目1 【如果不想用项目1,也可以自定义其他项目】location / {try_files $uri $uri/ /项目1/index.html;#			root   html;#			index  index.html index.htm;}# 项目1 项目location /项目1 {alias /usr/local/nginx/html/项目1;try_files $uri $uri/ /项目1/index.html;}# 项目2 项目location /项目2 {alias /usr/local/nginx/html/项目2;try_files $uri $uri/ /项目2/index.html;}# 项目3 项目location /项目3 {alias /usr/local/nginx/html/项目3;try_files $uri $uri/ /项目3/index.html;}}
}

这样页面访问时就可以是:http://test.top/项目1/http://test.top/项目2/http://test.top/项目3/

本机地址配置多个项目

本机地址配置多个项目这个其实和一个域名配置多个项目是一样的,只不过把server_name的域名换成localhost就行。

具体操作如下:

①、首先将项目移动到html下;
②、然后进行nginx配置;

Nginx配置文件完整代码展示(主要在server段):


user root;
worker_processes 1;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;sendfile on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout 65;#gzip  on;server {listen 80;server_name localhost;# 设置错误页面error_page 404 /404.html;error_page 500 /500.html;location = /404.html {root /usr/local/nginx/html;internal;}location = /500.html {root /usr/local/nginx/html;internal;}# 定义项目根目录root /usr/local/nginx/html;# 默认访问 html/下的index.html页面location / {root html;index index.html index.htm;# 如果需要以项目1为默认页,可以把这个配置打开,上面的两个注释了就行;# try_files $uri $uri/ /项目1/index.html;}# 项目1 项目location /项目1 {alias /usr/local/nginx/html/项目1;try_files $uri $uri/ /项目1/index.html;}# 项目2 项目location /项目2 {alias /usr/local/nginx/html/项目2;try_files $uri $uri/ /项目2/index.html;}}
}

这样页面访问的是时候就可以是:ip/项目1/ip/项目2/

推荐一个优化nginx配置文件的页面:Nginx配置文件格式化

这里面还有很多格式化工具可以自己看看:https://tool.okcode.vip/

Nginx 404页面美化:Nginx 404页面美化

相关文章

文章标题文章连接
【Linux】nginx基础篇 – 介绍及yum安装nginxhttps://liucy.blog.csdn.net/article/details/133928000
【Linux】环境下部署Nginx服务 - 二进制部署方式https://liucy.blog.csdn.net/article/details/132145067
nginx配置负载均衡–实战项目(适用于轮询、加权轮询、ip_hash)https://liucy.blog.csdn.net/article/details/133986013
nginx快速部署一个网站服务 + 多域名 + 多端口https://liucy.blog.csdn.net/article/details/133986102
【Linux】Nginx一个域名https&一个地址配置多个项目【项目实战】https://liucy.blog.csdn.net/article/details/144442148

相关专栏

❀《Linux从入门到精通》专栏 ❀
❀《Nginx》专栏 ❀

🐋 希望大家多多支持,我们一起进步!😄
🎉如果文章对你有帮助的话,欢迎 点赞 👍🏻 评论 💬 收藏 ⭐️ 加关注+💗

http://www.tj-hxxt.cn/news/24149.html

相关文章:

  • 网站后台程序开发广州seo报价
  • 贵州最好的网站建设推广公司哪家好百度权重怎么看
  • 网站开发设计实训实训总结ue5培训机构哪家强
  • 网站如何做长尾词排名aso优化师
  • 页面设计层次架构包括什么大型网站seo课程
  • 网站制作要学多久中国企业网络营销现状
  • 国内b2b电子商务平台seo关键词分类
  • 进出口代理公司关键词优化网站排名
  • 电子商城网站开发 pdf营销推广方案模板
  • wordpress 建视频网站广告代发平台
  • 南充网站建设公司市场营销策划公司
  • 做网站还要做点手机吗如何在百度上打广告
  • 软件最全的软件商店成都抖音seo
  • 怎么建设外贸网站注册域名在哪里注册
  • 微信如何做微商城网站班级优化大师学生版
  • 域名注册成功后怎么使用网站青岛网站建设培训学校
  • 四六级查成绩网站怎么做教育机构退费纠纷找谁
  • 百度网页版入口链接深圳seo教程
  • web2.0网站开发d建立网站平台需要多少钱
  • ui设计师的工作内容是什么网站seo工具
  • 连锁 加盟 网站模板西安今天刚刚发生的新闻
  • wordpress单页导航山西优化公司
  • 青岛商媒做网站怎么样百度推广账户登录首页
  • 金融行业网站建设方案网络营销优化培训
  • 做相关性分析的网站网站排名软件包年
  • 高性能网站建设指南在线阅读找客源免费用哪个软件好
  • 长沙网站推全球中文网站排名
  • 中国建设部城乡建设网优化网站推广教程排名
  • 做淘宝客的网站所需空间普通话的顺口溜6句
  • 电影wordpress自己怎么优化关键词