Setting up a staging sub-domain: what have I done wrong?

I am trying to create a staging sub-domain for a live Wordpress installation, but it is not accessible. Here are the steps I have taken so far:

  • Add a new A record (lwst), point it to the same IP address as my site
  • Duplicate mysite.com.conf, change all instances of mysite.com.conf to the staging URL lwst.mysite.com.conf
  • Created /var/www/html/lwst.mysite.com/
  • Copied all files from /var/www/html/mysite.com to /var/www/html/lwst.mysite.conf
  • Used Certbot to add https certificate for lwst.mysite.com
  • Enabled my new site [sudo a2ensite lwst.mysite.com.conf]
  • Restarted Apache[service apache2 reload]

Have I missed some steps?

Navigating to lwst.mysite.com gives an ISP error page "the website cannot be found".

EDIT 2:

Navigating to https://lwst.mysite.com gives a "errconnectiontimed_out" error.
Two friends have managed to navigate to the page, but it just redirects them to the https://mysite.com, ignoring the subdomain.

EDIT 1: I'd left the old rewrite engine stuff in the duplicated .conf file, however this has now been removed and overwritten and I'm still getting the same issue.

4 Replies

Hello @chr0s

Look into lwst.mysite.com.conf and make sure DocumentRoot is properly configured (/var/www/html/lwst.mysite.com/).

MAke sure you set the permissions right for lwst.mysite.com.conf file and /var/www/html/lwst.mysite.com/ folder.

Try to add the virtual host directly to the apache httpd.conf
Try without the SSL Certificate see if it works(you can get time out errors if you didn t properly installed your SSL Certificate).

Did you cloned your live worpdress instalation from diferent server than the staging one ?

Can you show us your lwst.mysite.conf file ?

Check out these guides to see if you missed something:

https://www.linode.com/docs/security/ssl/ssl-apache2-debian-ubuntu/

https://www.linode.com/docs/platform/migrate-to-linode/migrate-a-lamp-website-to-linode/

https://www.linode.com/docs/web-servers/lamp/install-lamp-stack-on-ubuntu-16-04/

Hi @cbits

I worked through your recommendations:

  • DocumentRoot is properly configured
  • I believe the permissions are set correctly: can you remind me what they should be set to so I can compare?
  • I don't know how to do this: "Try to add the virtual host directly to the apache httpd.conf"
  • The SSL certificate was configured in exactly the same way as my other site, and that functions correctly.
  • The Wordpress installation was cloned from this same server

The lwst.mysite.conf file is as follows:

<Directory /var/www/html/lswt.mysite.com/public_html>
Require all granted
</Directory>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName lwst.mysite.com
ServerAlias lwst.mysite.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/lwst.mysite.com/public_html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog /var/www/html/lwst.mysite.com/logs/error.log
CustomLog /var/www/html/lwst.mysite.com/logs/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =lwst.mysite.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

So I figured it out. I forgot to do these things:

  • Update the site name in wp-config.php
  • Duplicate the database into a testing database
  • Update database login credentials in wp-config.php

Nice! Glad you were able to figure it out @chr0s.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct