nginx 内容
1、 下载nginx服务器 nginx下载地址
- 选择稳定版本
2、解压到文件夹
- 最好全英文路径
3、开始使用
开始Nginx服务器
1 使用命令行 ,输入指令
start nginx // 启动nginx
nginx -s reload // 修改配置后重新加载
服务器使用nginx
-
修改配置文件
/etc/nginx/nginx.conf
-
启动nginx
/usr/sbin/nginx // 重启 /usr/sbin/nginx -s reload
nginx的一些操作
1 解压zip
unzip test.zip ->将test.zip解压到当前文件下
unzip -n test.zip -d /tmp ->将test.zip解压到/tmp目录下,并且不要覆盖已有文件
unzip -v test.zip ->查看test.zip内容,但不解压
unzip -o test.zip -d tmp/ ->将test.zip解压到/tmp目录下,并且覆盖已有文件
// 在 backuphtml
unzip -o 07-20210406.zip -d ../html 即可
2 移动
mv test.txt ../myDir
// 将 test.txt 文件 剪切到 myDir 文件夹内
3 删除
// 删除 文件
2 nginx的history配置
```nginx
server {
listen 8080; #指定端口
server_name baidu.com; #指定域名
#root /root/kkb-honor-admin/client/dist; 指定目录,根目录
#index index.html;
location / {
# history fallback vue的history模式配置
# 回退的逻辑
# 先查找对应的url命名的文件,找不到查url对应的目录文件夹,最后还找不到就回退到当前目录下的index.html(也就是dist/ 目录下,下面只有index.html css js font)
try_files $uri $uri/ /index.html;
# 根目录
root /root/kkb-honor-admin/client/dist;
}
# 接口的代理
location /mock-api/v1 {
proxy_pass http://127.0.0.1:9528;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real_Ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}