Site problem - can't find "<virtualhost>"

My domain is: alcalacompra.com

I ran this command:

It produced this output:

My web server is (include version): Apache/2.4.52 (Ubuntu)

The operating system my web server runs on is (include version):Linux ubuntu 5.15.0-1030-raspi #32-Ubuntu SMP PREEMPT Tue May 23 12:12:04 UTC 2023 armv7l armv7l armv7l GNU/Linux

My hosting provider, if applicable, is: hostinger

I can login to a root shell on my machine (yes or no, or I don't know): Permission denied, please try again ; )

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
Just command line

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): Certbot 2.6.0

imagen

I got the same problem can you tell me how to solve this issue please.

y found httpd.conf file under this directory

ubuntu@ubuntu:/snap/certbot/3025/lib/python3.8/site-packages/certbot_apache/_internal/tests/testdata/gentoo_apache/apache/apache2$ ls
httpd.conf magic modules.d vhosts.d

grep -i include httpd.conf

moving to a new topic...

2 Likes

That's not the correct Apache configuration you should look at. That httpd.conf you found is just testdata (as specified in the path) for Certbot, not configuration files actually used when either running Certbot nor used by your own webserver.

@hiddenotebook Please start from the beginning by answering the Help sections questionnaire I've pasted below, as this thread was split from another, so you didn't get it:


Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. crt.sh | example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:

I ran this command:

It produced this output:

My web server is (include version):

The operating system my web server runs on is (include version):

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don't know):

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):

5 Likes

Thank you for your answer Osiris.

I'm been reading on the web and a get the conclusion that the configuration file in my case is located in:
/etc/apache2/

Because the server is installed on Ubuntu, please correct me if i'm not right.

Inside that directory is apache2.conf, and other important directories.

/apache2.conf
/conf-available
/conf-enabled
/envvars
/magic
/mods-available
/mods-enabled
/ports.conf
/sites-available
/sites-enabled

I think that file is my configuration file. if you look inside the first line clearly says:

#This is the main Apache server configuration file. It contains the
#configuration directives that give the server its instructions.
#See Apache HTTP Server Version 2.4 Documentation - Apache HTTP Server Version 2.4 for detailed information about
#the directives and /usr/share/doc/apache2/README.Debian about Debian specific
#hints.

#Summary of how the Apache 2 configuration works in Debian:
#The Apache 2 web server configuration in Debian is quite different to
#upstream's suggested way to configure the web server. This is because Debian's
#default Apache2 installation attempts to make adding and removing modules,
#virtual hosts, and extra configuration directives as flexible as possible, in
#order to make automating the changes and administering the server as easy as
#possible.

#It is split into several files forming the configuration hierarchy outlined
#below, all located in the /etc/apache2/ directory:

       /etc/apache2/
      |-- apache2.conf
      |       `--  ports.conf
      |-- mods-enabled
      |       |-- *.load
      |       `-- *.conf
      |-- conf-enabled
      |       `-- *.conf
      `-- sites-enabled
              `-- *.conf

I am totally newbie in these server issues, but it seems that this is the configuration file in my case.

Thank you all for your invaluable assistance! your guidance and support have been immensely appreciated. I am truly grateful

Yes, that is the normal path for Apache2.
What shows?:
sudo apachectl -t -D DUMP_VHOSTS
ls -l /etc/apache2/sites-enabled/

3 Likes

Hi, nice to read you, I appreciate your affirmation.

The output of sudo apachectl -t -D DUMP_VHOSTS is this one:

hiddenotebook@ubuntu:~$ sudo apachectl -t -D DUMP_VHOSTS
[sudo] password for hiddenotebook:
VirtualHost configuration:
*:80      www.alcalacompra.com (/etc/apache2/sites-enabled/prestashop.conf:1)
*:443     www.alcalacompra.com (/etc/apache2/sites-enabled/prestashop.conf:19)

The output of ls -l /etc/apache2/sites-enabled/ is:


hiddenotebook@ubuntu:~$ ls -l /etc/apache2/sites-enabled/
total 0
lrwxrwxrwx 1 root root 34 Jun 16 11:45 prestashop.conf -> ../sites-available/prestashop.conf

Returning to the topic that has brought us to this post ¿why is so important to have a section of <VirtualHost> inside the configuration file?

I don't have the same problem as our partner @H.Furukawa I can install the certificates without problems i'm just wondering about the file httpd.conf, and I found this asking a chatgpt:

I ask this question:

Where is the file httpd.conf on server Apache 2.4.52 with Ubuntu?

chat.openai says:


In Apache 2.4.52 installations on Ubuntu, the main configuration file `httpd.conf` is typically not used by default. Instead, Ubuntu uses a different configuration structure for Apache. Here's the general file structure for Apache configuration on Ubuntu:

1. The main configuration directory is `/etc/apache2/`.
2. The main configuration file is `apache2.conf`, located in the `/etc/apache2/` directory. This file contains global configuration directives and includes other configuration files.
3. The additional configuration files are stored in the `/etc/apache2/conf-available/` directory. These files are typically organized by purpose or module.
4. Enabled configuration files are symlinked from the `/etc/apache2/conf-enabled/` directory to the corresponding files in `/etc/apache2/conf-available/`. These enabled files are the ones that are actually loaded by Apache.

Instead of directly modifying `httpd.conf`, it's recommended to use the appropriate configuration files in the `/etc/apache2/conf-available/` directory or the `/etc/apache2/sites-available/` directory for specific virtual hosts.

Right now I have a lot of questions to answer, I hope you don't mind.

I am going to change the title of the post to, Where is the configuration file on server Apache 2.4.52 with Ubuntu? I think it is a more correct description for this thread.

That's really a better question for the Ask Ubuntu forum or an Apache forum. We are not a general support forum for Apache

You could try below for Ubuntu Apache. And, the Community section on that page
https://ubuntu.com/server/docs/web-servers-apache

4 Likes

Certbot's Apache integration requires it because it uses the VirtualHost to determine which names may be included in a certificate, which part of the configuration to modify in order to satisfy the certificate authority's challenge, and which part of the configuration file to modify in order to install the certificate.

Certbot developers were comfortable requiring this because it is the configuration method suggested by most Apache documentation, and supported by other Apache-related tools.

If you specifically wanted to use Certbot with an Apache installation that just uses the base httpd.conf with no VirtualHost at all, you could use certbot --webroot instead of certbot --apache and then edit the httpd.conf manually to install the certificate. Certbot will not be able to do this with certbot --apache in this scenario.

3 Likes

If they understood how to implement SNI, then all this would already be clear.

3 Likes

Thank you MikeMcQ yes you right, I'm sorry for the offtopic.

@schoen Thanks Seth for the explanation, I really appreciate it.

@rg305 thank you Rudi I will read that I promise.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.