Thanks Daniel for pointting out these.
While i changed the config to follows:
<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 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>
RewriteEngine on
RewriteCond %{SERVER_NAME} =mail.openmbox.net
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
And I restarted apache2 without error.
But http://mail.openmbox.net still points to the default site.
Can you help further?
Regards.
Henry
November 11, 2022 at 6:01 PM, "Daniel Ferradal" <[email protected]> wrote:
>
> Allow me to step aside from your question for a moment, I believe if
> you don't get the basics right you should just stop, this is very
> important:
>
> Directory directive specifies a directory in your filesystem, ***do
> not ever allow anything in /***, even less the execution of cgi
> scripts.
>
> You are also mixing authz 2.2 directives with 2.4 directives.
>
> And also allowing .htaccess files to be used throughout your whole
> operative system.
>
> Briefly it is a compendium of ill advice.
>
> In your server config context you should define at least these:
>
> <Directory />
> Options None
> AllowOverride none
> Require all denied
> </Directory>
>
> and inside your virtualhost:
>
> DocumentRoot /var/www/snappy
> <Directory /var/www/snappy>
> #Options "add whatever options you do need, do not add random options .."
> Require all granted
> </Directory>
>
> and then configure other directories or whatever you need for service.
> But these above are the basics.
>
> About including AllowOverride directive, only do if you want non-admin
> users to setup specific directories configuration, set it up where it
> is really needed (NOT EVER system wide), most times using .htaccess
> will just complicate your life otherwise.
>
> El vie, 11 nov 2022 a las 10:08, <[email protected]> escribió:
>
> >
> > 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]
> >
>
> --
> Daniel Ferradal
> HTTPD Project
> #httpd help at Libera.Chat
>
> ---------------------------------------------------------------------
> 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]