网站首页 > 技术教程 正文
nginx作为一个具有高性能的http、https、反向代理web服务器,非常适合托管静态资源文件。
它的优点太多,在这里就不一一解说,我们直接看实际应用例子。
1、网站在nginx目录
1.1 默认
server{
# 监听的端口
listen 14553;
# 绑定的域名,多个用空格分开即可。
server_name localhost prvt.cool www.prvt.cool;
location / {
root web;
index index2.html;
}
}
1.2 别名/虚拟目录
server{
# 监听的端口
listen 14553;
# 绑定的域名,多个用空格分开即可。
server_name localhost prvt.cool www.prvt.cool;
location / {
root web;
index index2.html;
}
location /new2 {
alias web/new;
index indexNew.html;
}
}
2、网站在其它目录
server{
# 监听的端口
listen 14553;
# 绑定的域名,多个用空格分开即可。
server_name localhost prvt.cool www.prvt.cool;
location / {
alias E:/demo/web/;
index index2.html;
}
location /new2 {
alias E:/demo/web/new/;
index indexNew.html;
}
}
3、代理其它web服务器(静态)站点
这种完全可以通过NGINX直接代理,避免浪费服务器资源,然而也可以作为前置机。
详见:nginx 代理转发 http https 基本用法文章。
人人为我,我为人人,欢迎您的浏览,我们一起加油吧。
猜你喜欢
- 2024-10-10 推荐几个开源的个人独立博客系统(开源个人博客源码下载)
- 2024-10-10 Kubernetes 之 Nginx 动静态 PV 持久存储 下篇
- 2024-10-10 FreeMarker-静态模板的使用与生成
- 2024-10-10 使用nginx做前端服务器可以设置类似的静态文件客户端缓存
- 2024-09-12 「nginx」十、nginx的location配置详解
- 2024-09-12 使用nginx部署前端html等静态页面
- 2024-09-12 Nginx配置文件(nginx配置文件位置)
- 2024-09-12 基于nginx反向代理实现网站静态页面与动态页面自动切换
- 2024-09-12 nginx学习总结(nginx入门教程)
- 2024-09-12 除了负载均衡,Nginx还可以做很多,限流、缓存、黑白名单等
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)