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/ ...
随机推荐
- Oracle学习笔记:一个简单的行转列例子
一个简单的行列转换例子,原始数据. create table temp_cwh_student ( name ), subject ), score ) ) select * from temp_cw ...
- 如何将webstrom本地的代码上传到github上
首先注册一个github账户,然后下载一个git软件. 文件夹的任意处点击右键,找到gitbash here,打开终端命令窗口. 因为我们本地 Git 仓库和 GitHub 仓库之间的传输是通过 S ...
- php操作 cookie
1,设置cookie <?php setcookie('key'); setcookie('key1','value1'); setcookie(***); setcookie('key4', ...
- mac 下安装mysql
1.安装mysql 使用 brew 进行安装: brew install mysql 2.安装完成: 3.如果开机启动服务 执行:brew services start mysql 否则:mysql. ...
- Linux工具- Sysdig
Sysdig 是一个超级系统工具,比 strace.tcpdump.lsof 加起来还强大.可用来捕获系统状态信息,保存数据并进行过滤和分析.使用 Lua 开发,提供命令行接口以及强大的交互界面. 使 ...
- 【异常】Could not find artifact com.wm.****:
1 详细异常 [ERROR] Failed to execute goal on project spark-etl: Could not resolve dependencies for proje ...
- (九)How to use the audio gadget driver
Contents [hide] 1 Introduction 2 Audio Gadget Driver 1.0 2.1 Enabling the audio gadget driver 2.2 U ...
- shell基本概念
一.shell分类 常见shell:bash.zsh.tcsh linux默认:bash shell #tcsh #bash #pstree | grep login |- .. .. |-login ...
- 【转载】MCMC和Gibbs Sampling算法
转载随笔,原贴地址:MCMC和Gibbs Sampling算法 本文是整理网上的几篇博客和论文所得出来的,所有的原文连接都在文末. 在科学研究中,如何生成服从某个概率分布的样本是一个重要的问题.如果样 ...
- Problem C Shopping 闭环贪心
#include <bits/stdc++.h> using namespace std; ; int fa[maxn]; int main(){ int n, m; scanf(&quo ...