阿里云安全组添加端口2020
服务器开启2020端口
iptables 开放2020端口
-A INPUT -m state--state NEW -m tcp -p tcp --dport 2020 -j ACCEPT
重启iptables
service iptables restart
我这里使用的是内置防火墙
开放2020
firewall-cmd --zone=public --add-port=2020/tcp --permanent
重启防火墙
systemctl restart firewalld
下面是我的2020端口https nginx配置全部代码
正常配置可以从::/etc/nginx/nginx.conf
下面是我的配置路径
路径:/etc/nginx/conf.d/admin.conf
server {
listen 2020 ssl;
server_name www.我的网址.com;
client_max_body_size 10M;
ssl on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10s;
ssl_certificate /etc/nginx/conf.d/ssl/adminSSl.pem;
ssl_certificate_key /etc/nginx/conf.d/ssl/adminSSl.key;
access_log /logs/admin.log;
index index.html;
root /html/peixun/dist;
charset utf-8;
location / {
try_files $uri $uri/ @router;
index index.html index.htm;
}
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 9;
gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
error_page 405 =200 @405;
location @405{
root /opt/htdocs;
}
location @router {
rewrite ^.*$ /index.html last;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log on;
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
重启nginx
service nginx restart
此时便可访问:
https://www.我的网址.com:2020 访问到网站了