Nginx:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第78行: 第78行:
   listen 80;
   listen 80;
   server_name quser.abc.xyz;
   server_name quser.abc.xyz;
   porxy_pass 127.0.0.1:3100;
   proxy_pass 127.0.0.1:3100;
   proxy_set_header Host      $host;
   proxy_set_header Host      $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Real-IP $remote_addr;

2022年8月12日 (五) 02:56的版本

返回上一级

参数

permanent redirect 示例
示例 示例 示例
示例 示例 示例

配置

favicon.ico 示例 示例
示例 示例 示例
示例 示例 示例

进程

查看进程。

[jian@kang /home/kangkk]$
ps -ef | grep nginx

杀死进程。

[jian@kang /home/kangkk]$
kill -TERM 进程号
# or
kill -INT 进程号
# or
kill -QUIT 进程号
# or
pkill -9 nginx

验证 nginx 配置

[jian@kang /home/kangkk]$
nginx -t

重启

重新加载配置文件进行重启。

[jian@kang /home/kangkk]$
nginx -s reload

使用 nginx 进程号进行重启。

[jian@kang /home/kangkk]$
kill -HUP 进程号

ssl_dhparam

路径重写

去除 /api/ 前缀,并代理到新的服务器地址。

location /api/ {
  rewrite ^/api/(.*) /$1 break;
  proxy_pass http://127.0.0.1:8080;
}

安装

windows安装 Mac安装 示例
示例 示例 示例
示例 示例 示例

转发

端口转发

简单的端口转发。

nginx.conf
server {
  listen 80;
  server_name quser.abc.xyz;
  proxy_pass 127.0.0.1:3100;
  proxy_set_header Host      $host;
  proxy_set_header X-Real-IP $remote_addr;
}

socket

error