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, change all instances of to the staging URL
  • Created /var/www/html/
  • Copied all files from /var/www/html/ to /var/www/html/lwst.mysite.conf
  • Used Certbot to add https certificate for
  • Enabled my new site [sudo a2ensite]
  • Restarted Apache[service apache2 reload]

Have I missed some steps?

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


Navigating to gives a "errconnectiontimed_out" error.
Two friends have managed to navigate to the page, but it just redirects them to the, 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 and make sure DocumentRoot is properly configured (/var/www/html/

MAke sure you set the permissions right for file and /var/www/html/ 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:

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/>
Require all granted
<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.
DocumentRoot /var/www/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/
CustomLog /var/www/html/ 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}
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
# 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.


Please enter an answer

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] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct