LAMP Server: How to configure basic A record/CNAMES?

Status
Not open for further replies.

oguruma

Patron
Joined
Jan 2, 2016
Messages
226
I have a Wordpress site I want to host out of a Ubuntu LAMP server.

I currently have Webmin configured using a subdomain. I have a webmin.mydomain1.com pointing to the IP of the LAMP server.

I can access Webmin just fine using the subdomain.

Domain2.com is the domain for the Wordpress site. I currently have an A record for domain2.com "@ IP.OF.SERVER" pointing to the LAMP server. Domain2.com resolves to the LAMP server's IP.

When I try to browse to domain2.com I get " Invalid URL The requested URL "[no URL]", is invalid."

When I navigate to webmin.domain1.com/domain2.com/public_html I get served the Wordpress files.

So, I can use the subdomain followed by the Wordpress directory to access the Wordpress site, but not Wordpress domain (domain2.com) itself.

I would assume that I have my A record/CNAME screwed up somewhere.

Any ideas?

Code:
<VirtualHost *:80>
# The primary domain for this host
ServerName example1.com
# Optionally have other subdomains also managed by this Virtual Host
ServerAlias example1.com *.example1.com
DocumentRoot /var/www/html/example1.com/public_html
<Directory /var/www/html/example1.com/public_html>
Require all granted
# Allow local .htaccess to override Apache configuration settings
AllowOverride all
</Directory>
# Enable RewriteEngine
RewriteEngine on
RewriteOptions inherit

# Block .svn, .git
RewriteRule \.(svn|git)(/)?$ - [F]

# Catchall redirect to www.example1.com
RewriteCond %{HTTP_HOST}   !^www.example1\.com [NC]
RewriteCond %{HTTP_HOST}   !^$
RewriteRule ^/(.*)		 https://www.example1.com/$1 [L,R]

# Recommended: XSS protection
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
</IfModule>
</VirtualHost>
 
Last edited:

oguruma

Patron
Joined
Jan 2, 2016
Messages
226

My virtualhost file is below, which is the same as (other than the domain, obviously) I have used on another VPS which functions without issue. T

This is what leads me to believe I have screwed up a DNS setting....

<VirtualHost *:80>
# The primary domain for this host
ServerName example1.com
# Optionally have other subdomains also managed by this Virtual Host
ServerAlias example1.com *.example1.com
DocumentRoot /var/www/html/example1.com/public_html
<Directory /var/www/html/example1.com/public_html>
Require all granted
# Allow local .htaccess to override Apache configuration settings
AllowOverride all
</Directory>
# Enable RewriteEngine
RewriteEngine on
RewriteOptions inherit

# Block .svn, .git
RewriteRule \.(svn|git)(/)?$ - [F]

# Catchall redirect to www.example1.com
RewriteCond %{HTTP_HOST} !^www.example1\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) https://www.example1.com/$1 [L,R]

# Recommended: XSS protection
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
</IfModule>
</VirtualHost>
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I would assume that I have my A record/CNAME screwed up somewhere.
What makes you think that? I don't think I can be a lot of help wrt what your problem is, but I'm pretty sure it isn't this based on what you've said.
 
Status
Not open for further replies.
Top