Nginx一个server配置多个location
在配置文件中增加多个location,每个location对应一个项目
比如使用8066端口,location / 访问官网; location /demo访问培训管理系统
配置多个站点
我选择了配置多个location。
location / {
root /data/html/;
index index.html index.html;
}
location /demo{
root /data/trainning/;
index index.html index.html;
}
配置完以后访问。http://xxxx/train 提示404
找了好久才搞明白, location如果一个特定的url 要使用别名,不能用root,alias指定的目录是准确的,root是指定目录的上级目录,改动后即可以使用了
location /train {
alias /data/trainning/;
index index.html index.html;
}
Nginx一个server配置多个location的更多相关文章
- Nginx一个server配置多个location(使用alias)
公司测试环境使用nginx部署多个前端项目.网上查到了两个办法: 在配置文件中增加多个location,每个location对应一个项目比如使用80端口,location / 访问官网: locati ...
- Nginx httpS server配置
Nginx httpS 配置 配置同时支持http和httpS协议: server { listen ; #backlog:每个网络接口接收数据包的速率比内核处理这些包的速率快时,允许送到队列的数据包 ...
- Nginx(六):配置解析之location解析
nginx成为非常流行的代理服务软件,最根本的原因也许是在于其强悍性能.但还有一些必要的条件,比如功能的完整,配置的易用,能够解决各种各样的实际需求问题,这些是一个好的软件的必备特性. 那么,今天我们 ...
- Nginx同server配置下配置多个localhost路由地址
nginx多页面路由配置,进入 nginx/conf/nginx.conf: http { ...... server { listen 80; server_name localhost; loca ...
- nginx多server配置记录
直接在配置文件(/etc/nginx/nginx.conf)中添加如下代码: server { listen 8080; server_name 192.168.100.174:8080; root ...
- nginx下面server配置
haomeiv配置 log_format www.haomeiv.com '$remote_addr - $remote_user [$time_local] "$request" ...
- nginx一个端口配置多个不同服务映射
upstream tomcat_server{ server 127.0.0.1:8087; server 192.168.149.117:8088; } server { listen 8088; ...
- Nginx一个server主机上80、433,http、https共存
如果一站点既要80 http访问,又要443https访问. 要让https和http并存,不能在配置文件中使用ssl on,配置listen 443 ssl; 实例 server { listen ...
- nginx.conf及server配置
#服务运行用户 user sysadmin www; #工作进程数 worker_processes 4; #错误日志位置 error_log /data/sysadmin/service_logs/ ...
随机推荐
- vue-cli3配置eslint
一.默认配置 以下是package.json文件中关于的eslint默认配置 "eslintConfig": { "root": true, "env ...
- python 常见内置函数setattr、getattr、delattr、setitem、getitem、delitem
常见内置函数 内置函数:在类的内部,特定时机自动触发的函数 示例1:setattr.getattr.delattr class Person: # def __init__(self, name): ...
- Excel中把图片合并进图表的方法介绍
方法一: 使用“图案”对话框 双击某个数据系列,选择“图案”标签,单击“填充效果”按钮,在“填充效果”对话框中选择“图片”标签,单击“选择图片”按钮,选择一个要使用的图形文件即可. 方法二: 使用剪贴 ...
- 【Day2】3.面向对象编程
课程目标 1. 面向对象编程 2. 类和实例 3. 访问限制 4. 实例属性和类属性 面向对象编程 • 面向对象编程是一种程序设计思想 • 面向对象把类和对象作为程序的基本单元 • 对象包含属性和方法 ...
- dhcpd.conf配置文件几例
例1 ddns-update-style interim; ignore client-updates; subnet 192.168.222.0 netmask 255.255.255.0 { ...
- yocto 项目编译
1. 编译整个项目 构建编译环境: ~/fsl_6dl_release$ MACHINE=imx6dlsabresd source fsl-setup-release.sh -b build-wayl ...
- Hadoop_06_Hadoop的HDFS的概念和特性
1.HDFS的概念和特性 1.1. 首先,它是一个文件系统,用于存储文件,通过统一的命名空间——目录树来定位文件 1.2. 它是分布式的,由很多服务器联合起来实现其功能,集群中的服务器有各自的角色:重 ...
- JNetPcap安装及使用
啥是JNetPcap? JNetPcap是由Sly Technologies开发的开源DPI(Deep Packet Inspection)SDK. Java平台底层不支持底层网络操作,需要通过JNI ...
- 使用select异步IO实现socketserver服务器 源码剖析
#_*_coding:utf-8_*_ #这是一个echo server,客户端消息,服务端回复相同的消息 import select, socket, sys, queue # Create a T ...
- zencart用sql将某个产品属性值设为只读和默认
zencart用sql将某个产品属性值设为只读和默认 UPDATE `products_attributes` SET `attributes_display_only` = '1', `attrib ...