蘭雅sRGB 个人博客 | https://262235.xyz
Nginx支持rewrite, http跳转https
- vim /etc/nginx/sites-enabled/http 建立 http 配置文件,粘贴以下代码内容
# 使用全站加密,http自动跳转https |
也可以把http和https写在同一个文件里
|
frps 配置文件也可以独立起来存放
|
调试测试配置文件
配置完成后,先用 nginx –t 来测试下配置是否有误,正确无误的话,service nginx restart 重启nginx
root@vultr:~# nginx -t
nginx: [warn] conflicting server name "frp.srgb.xyz" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "s.srgb.xyz" on 0.0.0.0:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful使用命令 systemctl status nginx.service 查看nginx日志信息
root@vultr:~# systemctl status nginx.service
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-09-02 03:22:31 UTC; 1min 14s ago
Docs: man:nginx(8)
Process: 2748 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, statu
Process: 2754 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 2751 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 2756 (nginx)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/nginx.service
├─2756 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─2757 nginx: worker process
Sep 02 03:22:31 vultr.guest systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 02 03:22:31 vultr.guest nginx[2751]: nginx: [warn] conflicting server name "frp.srgb.xyz" on 0.0.0.0:80, ignored
Sep 02 03:22:31 vultr.guest nginx[2751]: nginx: [warn] conflicting server name "s.srgb.xyz" on 0.0.0.0:80, ignored
Sep 02 03:22:31 vultr.guest nginx[2754]: nginx: [warn] conflicting server name "frp.srgb.xyz" on 0.0.0.0:80, ignored
Sep 02 03:22:31 vultr.guest nginx[2754]: nginx: [warn] conflicting server name "s.srgb.xyz" on 0.0.0.0:80, ignored
Sep 02 03:22:31 vultr.guest systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Sep 02 03:22:31 vultr.guest systemd[1]: Started A high performance web server and a reverse proxy server.