惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LangChain Blog
WordPress大学
WordPress大学
MyScale Blog
MyScale Blog
The Cloudflare Blog
J
Java Code Geeks
Google DeepMind News
Google DeepMind News
Recent Announcements
Recent Announcements
Microsoft Azure Blog
Microsoft Azure Blog
Y
Y Combinator Blog
有赞技术团队
有赞技术团队
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler
小众软件
小众软件
量子位
月光博客
月光博客
P
Proofpoint News Feed
IT之家
IT之家
腾讯CDC
博客园 - 三生石上(FineUI控件)
博客园 - 司徒正美
雷峰网
雷峰网
V
Visual Studio Blog

博客园 - Lafite-1820

linux 常用的命令 mac m1 使用vpn之后浏览器连不上网处理 - Lafite-1820 Opus 4.6 真的用不起了!我换成了国产 M2.5,实测真香!! 5分钟搭建完整后端服务,这款开源的快速开发神器太牛了! 高并发IoT监控系统的Go实践:Goroutine池设计与并发安全指南 服务器设置成美国时间 Linux crond mysql mac m1 报错处理 PostgreSQL 为什么不选择 B+ 树索引? 秒杀系统的架构(Golang 实现) nginx 配置 git 突然 403 Vue 项目接入Google第三方登录的详细流程 mysql 添加账号 [HY000][1366] Incorrect string value: '\xF0\x9F\x8C\x9F",...' ; - Lafite-1820 mac 外接硬盘系统软件 linux 常用命令 crontab 半小时执行一次 mac berw 安装deepseek linux mv 限时文件个数
nginx 配置
Lafite-1820 · 2025-10-27 · via 博客园 - Lafite-1820

nginx html 配置

server {
    # 监听 80 端口
    listen 80;
    # 绑定域名(替换为你的实际域名)
    server_name oms.xxxxx.com;

    # 网站根目录(指向 dist 文件夹)
    root /xp/www/oms.xxxxx.com/dist;
    # 默认索引文件(前端项目通常为 index.html)
    index index.html;

    # 字符集设置
    charset utf-8;

    # 日志配置(可选,建议开启)
    access_log /var/log/nginx/oms.xxxxx.com.access.log;
    error_log /var/log/nginx/oms.xxxxx.com.error.log;

    # 处理前端路由(如 Vue Router 的 history 模式)
    location / {
        # 如果请求的文件或目录不存在,转发到 index.html
        try_files $uri $uri/ /index.html;
    }

    # 缓存静态资源(JS/CSS/图片等,可选)
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
        # 缓存有效期(根据实际需求调整,这里为 7 天)
        expires 7d;
        add_header Cache-Control "public, max-age=604800";
    }

    # 禁止访问隐藏文件(如 .git、.env 等)
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }
}