Page 1 of 1

Difficulties with the configuration of Virtual Hosts.

PostPosted: 01. December 2021 10:43
by CryptoRiot
My system:

Operating System: Manjaro Linux
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.10.79-1-MANJARO (64-bit)

I have installed:

[2021-11-23] XAMPP for Linux 8.0.13-0
This version of XAMPP contains the following software releases:
- Apache 2.4.51
- MariaDB 10.4.22
- OpenSSL 1.1.1l
- PEAR 1.7.1
- PHP 8.0.13
- phpMyAdmin 5.1.1
- Update kernel and systemd for OS X VM (CVE-2021-33909 and CVE-2021-33910)

I used the instructions http://localhost/dashboard/docs/configure-vhosts.html

But further than to uncomment
Include etc / extra / httpd-vhosts.conf

in file
/opt/lampp/etc/httpd.conf

I have not advanced.
My task.
I started learning PHP and installed the NetBeans editor. And I want to open a project on my local server. For which I installed XAMPP.
NetBeans offers to save projects to its own directory
/ home / hgpd / NetBeansProjects /

And at first I tried to configure localhost for this directory, but it didn't work out for me.
Then, I created a folder
/ opt / lampp / docs / cryptoriot

gave the cryptoriot folder permissions 777. And saved the project there. The contents of the cryptoriot folder, this is another folder I have designated to store the NetBeans metadata and the index.php project file. I selected docs because my httpd-vhosts.conf file is written:
Code: Select all
 <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
 
 <VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

My problem is, I do not understand what exactly should be in the httpd-vhosts.conf files and in / etc / hosts.
The original hosts file is as follows:
Code: Select all
# Host addresses
127.0.0.1  localhost
127.0.1.1  hgpd-hpelitebook2170p
::1        localhost ip6-localhost ip6-loopback
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters


I spent a day trying a bunch of variations. No result.
I also read the documentation at https://httpd.apache.org/docs/2.4/vhosts/examples.html, but for me it was like a sacred manuscript with spatial philosophical reasoning. And since I do not plan to become a server administrator in the near future, and for me, as a simple user, in such cases, it is better to contact those support of my hosting provider, then I want to ask the experts to just "poke a finger at me" - what exactly is in my the case should be written in the httpd-vhosts.conf and hosts files.

:mrgreen:

Re: Difficulties with the configuration of Virtual Hosts.

PostPosted: 01. December 2021 11:42
by Altrea
The directive ServerName needs to match one line in your /etc/hosts

Re: Difficulties with the configuration of Virtual Hosts.

PostPosted: 01. December 2021 13:35
by CryptoRiot
I know that. There should be
Code: Select all
127.0.0.1  localhost
127.0.1.1  hgpd-hpelitebook2170p
127.0.01 and something else
::1        localhost ip6-localhost ip6-loopback
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters

Re: Difficulties with the configuration of Virtual Hosts.

PostPosted: 01. December 2021 14:03
by Altrea
then i have no clue what problems or questions you have

Re: Difficulties with the configuration of Virtual Hosts.

PostPosted: 01. December 2021 14:22
by Nobbie
CryptoRiot wrote:I know that. There should be
Code: Select all
127.0.0.1  localhost
127.0.1.1  hgpd-hpelitebook2170p
127.0.01 and something else
::1        localhost ip6-localhost ip6-loopback
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters


I cannot see any ServerName of your VirtualHosts there.

Re: Difficulties with the configuration of Virtual Hosts.

PostPosted: 06. December 2021 05:51
by PatSer
Hello
As fare as I know, your /etc/hosts should contain something like:

Code: Select all
127.0.0.1  localhost
...
127.0.0.1 dummy-host.example.com dummy-host2.example.com
...

It did work for me.