0

I have newly installed apache2 and by visiting localhost apache2 is shown to be up and running. I want the same to happen when I put app in the browser. When I do try to go visit app the browser gives a Unable to connect message.

What I have done so far

I changed my etc/hosts/ file to include app.

127.0.0.1   localhost app
127.0.1.1   ubuntu
...

I would then expect http://app/ to resolve to the apache2 page(as I want it to), but that doesn't happen. Therefore I tried to ping app. This worked and was shown to resolve to 127.0.0.1.

Next I tried to restart apache2, but the result stayed the same.

Why do I get Unable to connect message and how do I make it redirect me to apache2?

EDIT:

I've tried to add app here too.

<VirtualHost *:80>
    ServerName app
    ServerAlias www.app
    ServerAdmin webmaster@app
    DocumentRoot /var/www/app

    ErrorLog ${APACHE_LOG_DIR}/app-error.log
    CustomLog ${APACHE_LOG_DIR}/app-access.log combined
</VirtualHost>

I then run the command a2ensite app.conf and then I restart apache2 with systemctl reload apache2.

Still when I put app in the browser field I get a Unable to connect message.

7
  • Hmm. Don't use a browser, but something that will actually give you a useful error message e.g. curl. Jul 19, 2021 at 23:46
  • That worked. Thanks. Why does curl work, but not the browser?
    – Mr Krisey
    Jul 19, 2021 at 23:49
  • Did you actually use the literal string app? You can't do that. It is a real live domain on the Internet and you don't own it. Use something else, like a subdomain of your own domain name. Jul 19, 2021 at 23:53
  • I used actually used app.dev.
    – Mr Krisey
    Jul 19, 2021 at 23:54
  • 1
    That's also a real live domain, you don't own it, and every domain in dev must use HTTPS. Browsers strictly enforce this. Jul 19, 2021 at 23:55

0

You must log in to answer this question.

Browse other questions tagged .