Browser unable to resolve website and other config issues

Hello experts,

I’ve a working grav blog hosted on AWS Linux as you can see by visiting http://54.227.171.31. There are two problems:

#1 - Internal URLs are unreachable

The site is located in the documentRoot /var/www/html.

Rewrite module is enabled, .htaccess has Rewritebase ‘/’ command enabled. (I’ve tried with it disabled too.)

user/config/system.yaml:

home:
  alias: /blog
  hide_in_urls: true

user/config/site.yaml:

blog:
route: ''

user/pages/01.blog/blog.md

blog_url: '/'

#2 - Browsers are unable to resolve the URL

There is an A record pointing to the server.

$ nslookup awsm.dvlprz.com
Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
Name:	awsm.dvlprz.com
Address: 54.227.171.31

$ host awsm.dvlprz.com
awsm.dvlprz.com has address 54.227.171.31
awsm.dvlprz.com mail is handled by 1 redirect.ovh.net.

Apache is configured with virtual host for both :80 and :443

<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName "awsm.dvlprz.com"
ServerAlias "awsm.dvlprz.com"
RewriteEngine on
RewriteCond %{SERVER_NAME} =awsm.dvlprz.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
DocumentRoot "/var/www/html"
ServerName "awsm.dvlprz.com"
ServerAlias "awsm.dvlprz.com"
SSLCertificateFile /etc/letsencrypt/live/awsm.dvlprz.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/awsm.dvlprz.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

@abhay First of all, I am a total infrastructure noob, so I might be mistaken…

Having said that, I am missing the following in your virtual host definition:

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

When I comment out the lines containing ‘AllowOverride All’ and ‘Require all granted’ I can only access the home page. When accessing a blog item I get the exact same error as on your site.

Do I know what that all does? No, I don’t… I rather read spaghetti code…

1 Like

@pamtbaau

Thank you! You’re my hero. The site works now. The configuration I added was:

<Directory /var/www/html/awsm.dvlprz.com>
AllowOverride All
Options MultiViews Includes FollowSymLinks
Order allow,deny
Allow from All
<Limit GET POST OPTIONS>
       Require all granted
</Limit>
<LimitExcept GET POST OPTIONS>
       Require all denied
</LimitExcept>
</Directory>

Then it worked with the IP address but still not with the URL. Had me stumped. Then I used another computer to test and voila!, the URL worked! That told me there was something specific to my computer. So cleared the DNS cache and still nothing!

Finally I checked the /etc/hosts file and found a long forgotten entry pointing to the old webserver! Something that I should have checked first!

Anyway, thank you for your help. Hope my saga helps someone oneday …

@abhay Be advised that access control in Apache 2.4 has changed. Have a look at the section ‘Access’ in the Apache document Upgrading to 2.4 from 2.2:

2.2 configuration:
Order allow,deny
Allow from all
2.4 configuration:
Require all granted

Forum hints:

  • To mark a topic as ‘solved’ you can tick the ‘solved’ checkbox at the lower right corner of any reply that lead you to the solution. That way users can see the topic is solved and see which post contains the solution.
  • Hero’s deserve our love… To show appreciation to a hero you might tick the ‘love’ button too… :wink:
    Uh no, you cannot give yourself a pat on the back…
1 Like