SpiceMan,
I follow your suggestions to set up as follows.
webmail.conf:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mail.openmbox.net
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =mail.openmbox.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
webmail-le-ssl.conf:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName mail.openmbox.net
DocumentRoot /var/www/snappy
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory />
Options None
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/snappy>
Options +Indexes
Order deny,allow
Allow from all
Require all granted
</Directory>
<Directory /var/www/snappy/data>
Require all denied
</Directory>
SSLCertificateFile /etc/letsencrypt/live/mail.openmbox.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mail.openmbox.net/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
And apache2 restarted without error.
but http://mail.openmbox.net still go to default site.
any idea?
regards.
November 11, 2022 at 6:03 PM, "SpiceMan" <[email protected]> wrote:
>
> Delete all that Rewrite voodoo and just redirect.
>
> <VirtualHost *:80>
> ServerName example.com
> ServerAlias www.example.com
>
> Redirect permanent / https://example.com/
> </VirtualHost>
>
> IMPORTANT NOTE:
> Also you are configuring all that access to your SYSTEM root directory.
> <Directory /> is the whole filesystem path there, not an url path.
>
> Don’t do that. Restrict all and allow what you need for your content, don’t
> expose your whole system.
>
> >
> > On Nov 11, 2022, at 18:07, [email protected] wrote:
> >
> > Hello,
> >
> > I have this hostname: mail.openmbox.net
> > when access it as http, it will be rewrited to https (rewrite and certs
> > setup by certbot automatically).
> >
> > this works fine in chrome browser.
> >
> > but when I access http://mail.openmbox.net/ in firefox, it will show the
> > default site.
> >
> > That's to say,
> >
> > http://mail.openmbox.net/ works correctly on chrome (show the correct site
> > and rewrite to https).
> > but it shows the default site (ubuntu default html) on firefox as you can
> > test it as well.
> >
> > I am totally confused. can you help?
> >
> > Thanks.
> >
> > Additional info:
> >
> > The version:
> > # apache2 -v
> > Server version: Apache/2.4.41 (Ubuntu)
> > Server built: 2022-06-14T13:30:55
> >
> > The config:
> > <VirtualHost *:80>
> >
> > ServerAdmin webmaster@localhost
> > ServerName mail.openmbox.net
> > DocumentRoot /var/www/snappy
> >
> >
> > ErrorLog ${APACHE_LOG_DIR}/error.log
> > CustomLog ${APACHE_LOG_DIR}/access.log combined
> >
> > <Directory />
> > Options +Indexes +FollowSymLinks +ExecCGI
> > AllowOverride All
> > Order deny,allow
> > Allow from all
> > Require all granted
> > </Directory>
> >
> > <Directory /var/www/snappy/data>
> > Require all denied
> > </Directory>
> >
> > RewriteEngine on
> > RewriteCond %{SERVER_NAME} =mail.openmbox.net
> > RewriteRule ^ https://% https://%25/ {SERVER_NAME}%{REQUEST_URI}
> > [END,NE,R=permanent]
> > </VirtualHost>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]