首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Apache不能使用端口80访问服务器。

Apache不能使用端口80访问服务器。
EN

Server Fault用户
提问于 2020-07-03 14:44:19
回答 1查看 1.2K关注 0票数 0

我在Ubuntu16.04上运行了apache服务器,它可以很好地处理80以外的端口,我已经转发了端口80,并尝试使用

https://mysite.ddns.net/index.html和页面无法加载。

如果我将端口更改为8085并转发它,然后尝试使用URL,

代码语言:javascript
运行
复制
`https://mysite.ddns.net:8085/index.html` 

那么它就能工作了,只有80端口的问题。

以下是配置文件

ports.conf

代码语言:javascript
运行
复制
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf


Listen 8075
Listen 80
Listen 443


    Listen 80



    Listen 80


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet    

默认-ssl.conf

代码语言:javascript
运行
复制
                ServerAdmin your_email@example.com


                DocumentRoot /var/www
                ServerName mysite.ddns.net


                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                SSLEngine on

                SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
                SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key


                
                                SSLOptions +StdEnvVars
                
                
                                SSLOptions +StdEnvVars
                

                BrowserMatch "MSIE [2-6]" \
                               nokeepalive ssl-unclean-shutdown \
                               downgrade-1.0 force-response-1.0

我已经使用命令允许iptable中的端口。

sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

还是不起作用。可能是什么原因。

EN

回答 1

Server Fault用户

发布于 2020-07-03 15:11:52

您正在尝试连接到https://mysite.ddns.net。https正在使用端口443。如果您在端口80上配置了https,则必须使用https://mysite.ddns.net:80

我建议在端口443中使用https。我会在端口80上为http配置第二个vhost,它将所有流量的重定向发送到https。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1023907

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档