nginx 安装与配置
2022-7-5
| 2024-3-20
0  |  阅读时长 0 分钟
type
status
date
slug
summary
tags
category
icon
password

安装nginx

yum -y install nginx
启动 service nginx start
停止 service nginx stop
重启 service nginx restart
测试nginx配置 nginx -t
配置文件目录 /etc/nginx/nginx.conf
index 路径 /usr/share/nginx/html

负载均衡

  • nginx.conf下添加:
  • nginx.conf中有 include /etc/nginx/conf.d/*.conf;,去conf.d文件夹下添加自定义配置文件

静态代理

nginx.conf中有 include /etc/nginx/conf.d/*.conf;,去conf.d文件夹下添加自定义配置文件(随意命名,只要是.conf结尾即可。)需要在域名解析中添加相应的二级域名解析。

https

主要配置如下,locationhttp 一样
支持全站加密,在 http 的 server 里增加rewrite ^(.*) https://$host$1 permanent;
如果需要做 https 下的反向代理
错误处理

FTP

只需在 location中配置:
  • 开发
  • 在 ubuntu 修改 hosts一些配置
    Loading...
    目录