-1

I desperately try to setup a name based virtual host for use in my local network, for hours.

This is my configuration, the path is correct

/etc/apache2/vhosts.d/hausfux.conf

<VirtualHost 192.168.40.44:80>

    ServerName hausfux.dev

    DocumentRoot "/srv/www/htdocs/hausfux/devLocal"
    ErrorLog /var/log/apache2/hausfux_error.log
    CustomLog /var/log/apache2/hausfux_access.log common

</VirtualHost>

I informed myself here.

Then I added this line to my /etc/hosts file.

192.168.40.44        hausfux.dev

I also added the same line on my windows clients hosts file.

Then I restarted apache2 with systemctl restart apache2.

If I enter http://hausfux.dev in my windows clients browser, then it automatically changes to https://hausfux.dev and it fails.

If I try to open the project as I used to,with the full absolute link, e.g. http://192.168.40.44/hausfux/devLocal then I get Status Error Code 500 (server internal error) now. If I remove my virtual host and restart apache2 then the site works again.

What am I doing wrong?

PS: There are no errors in /var/log/apache2/hausfux_error.log


Update

If I use the following configuration, then it works if I type in the servers IP Adress in the browser at my windows client (http://192.168.40.44).

NameVirtualHost *:80

<VirtualHost *:80>

    ServerName hausfux.dev

    DocumentRoot "/srv/www/htdocs/hausfux/devLocal"
    ErrorLog /var/log/apache2/hausfux_error.log
    CustomLog /var/log/apache2/hausfux_access.log common

    <Directory "/srv/www/htdocs/hausfux/devLocal">
        Require all granted
    </Directory>

</VirtualHost>

But my goal is, to just enter a name, e.g. http://hausfux.dev instead of the ip address. Is this possible in OpenSUSE or should I use another OS, e.g. Ubuntu?

Update:

Response from pinging my DNS-Server:

PING 192.168.40.20 (192.168.40.20) 56(84) bytes of data. 64 bytes from 192.168.40.20: icmp_seq=1 ttl=64 time=0.126 ms 64 bytes from 192.168.40.20: icmp_seq=2 ttl=64 time=0.149 ms

7
  • Clear your browser cache. Oct 18 '18 at 17:25
  • @MichaelHampton, I tried it. I even started the browser in inspector mode. Same problem.
    – Black
    Oct 19 '18 at 7:32
  • try with a command line tool like curl or wget. Additionally if you get redirected to the https part, create either a https part or find the reason why you are redirected, which is not in the config you show. Look in the error/access logs. Oct 19 '18 at 8:05
  • If you ping the DNS name, do you get the desired IP address or something else?
    – Tommiie
    Oct 19 '18 at 9:37
  • @Tom, I added the response to my question
    – Black
    Oct 19 '18 at 9:40
0

It works after I changed the virtual host name. I think I already used the same VHost name on my windows clients WAMP once and it is still in the config somewhere.

In WAMP you can suppress virtual hosts. Maybe I just supressed it instead of deleting it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.