900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > Linux os Nginx 配置https 自定义端口非443端口

Linux os Nginx 配置https 自定义端口非443端口

时间:2021-09-19 12:44:24

相关推荐

Linux os Nginx 配置https 自定义端口非443端口

阿里云安全组添加端口

服务器开启端口

iptables 开放端口

-A INPUT -m state--state NEW -m tcp -p tcp --dport -j ACCEPT

1

重启iptables

service iptables restart

1

我这里使用的是内置防火墙

开放

firewall-cmd --zone=public --add-port=/tcp --permanent

1

重启防火墙

systemctl restart firewalld

1

下面是我的端口https nginx配置全部代码

正常配置可以从::/etc/nginx/nginx.conf

下面是我的配置路径

路径:/etc/nginx/conf.d/admin.conf

server { #listen 80; listen 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; # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # ssl_ciphers HIGH:!aNULL:!MD5; # error_page 497 301 https://$http_host$request_uri; 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

1

此时便可访问:

https://www.我的网址.com: 访问到网站了

如未能成功,请下方留言,留下你的联系方式。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。