nginx配置二级目录
个人blog,欢迎关注加收藏
- 在路径
/etc/nginx/sites-enabled
或者/etc/nginx/sites-available
下找到default文件 - 打开default文件:
### You should look at the following URL's in order to grasp a solid understanding# of Nginx configuration files in order to fully unleash the power of Nginx.# http://wiki.nginx.org/Pitfalls# http://wiki.nginx.org/QuickStart# http://wiki.nginx.org/Configuration## Generally, you will want to move this file somewhere, and start with a clean# file but keep this around for reference. Or just disable in sites-enabled.## Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.### Default server configuration#server {listen 80 default_server;listen [::]:80 default_server;# SSL configuration## listen 443 ssl default_server;# listen [::]:443 ssl default_server;## Note: You should disable gzip for SSL traffic.# See: https://bugs.debian.org/773332## Read up on ssl_ciphers to ensure a secure configuration.# See: https://bugs.debian.org/765782## Self signed certs generated by the ssl-cert package# Don't use them in a production server!## include snippets/snakeoil.conf;root /var/www/html;# Add index.php to the list if you are using PHPindex index.html index.htm index.nginx-debian.html;server_name _;location / {# First attempt to serve request as file, then# as directory, then fall back to displaying a 404.try_files $uri $uri/ =404;}location /top {alias /var/www/html/top;index index.html index.htm;try_files $uri $uri/ =404;}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000##location ~ \.php$ {# include snippets/fastcgi-php.conf;## # With php7.0-cgi alone:# fastcgi_pass 127.0.0.1:9000;# # With php7.0-fpm:# fastcgi_pass unix:/run/php/php7.0-fpm.sock;#}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {# deny all;#}}# Virtual Host configuration for example.com## You can move that to a different file under sites-available/ and symlink that# to sites-enabled/ to enable it.##server {# listen 80;# listen [::]:80;## server_name example.com;## root /var/www/example.com;# index index.html;## location / {# try_files $uri $uri/ =404;# }#}
注意这部分内容
location /top {alias /var/www/html/top;index index.html index.htm;try_files $uri $uri/ =404;}
- 重启nginx:
在x-shell中输入命令nginx -s reload
- 在网页中打开网址
http://174.137.63.203/top/
nginx配置二级目录相关推荐
- nginx 二级目录 php,Nginx 配置二级目录支持
Nginx 配置二级目录并不像 apache 那么简单,但二级目录的配置在实际工作中又经常用到,现整理如下.欢迎大家访问 二愣的闲谈杂鱼 在 /etc/nginx 目录下创建文件夹 sublocati ...
- nginx配置二级目录,反向代理不同ip+端口
场景描述: 通过二级目录(虚拟目录,应用程序)的方式访问同一ip+端口的不同应用,例如location是用户使用页面,location/admin/是管理页面,location部署在192.168.1 ...
- Nginx配置二级目录反向代理本机不同端口
前序 最近在家里的服务器上装了一大堆的服务器软件,大多数都需要Web网站访问的,比如:Gitlab.Apache.Jenkins等等.然而又因为是不同的应用,需要占用不同的端口,每次访问起来都需要在I ...
- nginx配置二级目录访问tomcat
之前没有接触过nginx,但公司运维出现问题,于是由我来修改nginx配置文件,添加二级目录来访问tomcat下的项目. 推荐博客: https://blog.csdn.net/daybreak120 ...
- nginx 配置二级域名(阿里云)
使用 nginx 配置二级域名,只需要在 nginx.conf 文件中添加如下配置即可 server {listen 80;server_name music.finance.com;location ...
- nginx vue2+webpack 和 vue3+vite 配置二级目录访问
首先我们要配置一个106.13.0.11:8083/qfqzApp的二级路由,针对于vue2项目,我们需要进行一下操作. 1.nginx配置(vue2 和 vue3配置的nginx相同) server ...
- ruoyi-vue Nginx配置二级域名
一.前言 若依官网项目部署手册,前端部署到80端口一级域名下的.一级域名官网占用,这时就需要配置二级域名. 二.ruoyi-ui 前端vue配置 2.1 配置vue.config.js 修改publi ...
- Nginx通过二级目录映射不同的反向代理
今天前后端分离项目,部署时需要通过二级目录来区分前端和后端,参考了网上文章. 前端是静态页面,当客户访问http://localhost/ ,当访问路径是 / \color{red}{/} / 时,访 ...
- vue项目nginx部署二级目录
一.修改router.js中添加base根目录配置 const vueRouter = new Router({mode: 'history',base: 'app', 二.修改vue.config. ...
最新文章
- 【连载】优秀程序员的45个习惯之39——架构师必须写代码
- Stimulsoft Reports.Net基础教程(十):创建图表报表②
- 分享大厂分布式唯一ID设计方案,快来围观
- ArrayList和HashSet
- SpringCloud-Learning
- 简单介绍下我使用了一年多还不知道的Sql server 2005 组件知识
- 什么是Java Bean
- CSS可见区域全局居中
- linux cocos2dx 配置文件,Linux开发cocos2dx程序环境搭建
- SpringBoot项目集成Mybatis Plus(五)条件构造器
- 外贸电商ERP都有哪些值得用?
- java程序崩溃查询,java – 有程序识别它上次崩溃了吗?
- 2016、11、17
- ZABBIX 4.0 安装过程记录
- 通过nginx搭建一个基于http-flv的直播流媒体服务器
- web 实时刷新 websocket 大数据
- Discuz!开发之替换系统IP库为纯真IP库的方法
- isFinite方法详解
- android -- 蓝牙 bluetooth解读
- CImage类之GetBits、GetPixel、GetPitch、GetBPP应用