0

I have apache server running on Ubuntu 16.04 and which works fine with port other than 80, I have forwarded the port 80 and try to access my server using

https://mysite.ddns.net/index.html and the page cannot load.

And if I change the port to 8085 and forwarded it and then try with the URL,

`https://mysite.ddns.net:8085/index.html` 

then it works, only problem with port 80.

Here is the config files

ports.conf

# 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

<IfModule ssl_module>
    Listen 80
</IfModule>

<IfModule mod_gnutls.c>
    Listen 80
</IfModule>

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

default-ssl.conf

<IfModule mod_ssl.c>
        <VirtualHost _default_:80>
                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


                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

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

        

        </VirtualHost>


</IfModule>

I have allowed the port in iptable with the command.

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

Still not work. What could be the reason.

CodeDezk
  • 101
  • 2
  • Probably because you are running it at home and your residential ISP blocks incoming port 80. – Michael Hampton Jul 03 '20 at 14:59
  • How can I confirm it, actually I have to enable port 80 for installing ssl certificate from Let's Encrypt as describe here https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04. And it seems the port 80 should open for working it. – CodeDezk Jul 03 '20 at 15:02

1 Answers1

2

You are trying to connect to https://mysite.ddns.net. https is using port 443. If you have configured https on port 80, you have to use https://mysite.ddns.net:80.

I recommend to use https with port 443. I would configure a second vhost for http on port 80, which sends a redirect for all traffic to https.

  • Actually I have to open port 80 for htpp not for https. I have tested the http url also but still same result. – CodeDezk Jul 03 '20 at 16:00
  • Yes but actually you have configured https on port 80. In your posted configuration file you have configured a vhost on port 80 with "SSLEngine on" -> https – Alexander Worlitschek Jul 03 '20 at 16:07
  • I have edited it, and made the correct setting, I have make sure that the https is working with local ip `http://192.168.0.107/index.php` and no issue, only problem when accessing with dns – CodeDezk Jul 03 '20 at 16:21