Roots Discourse

(Separate Server for Subdomain) Seemingly successful use of Trellis, but production server seemingly not handling requests appropriately

I am very new to Wordpress / Roots.io / nginx so I would like to apologize in advance for my stupidity. :slight_smile:

I have spent a couple days trying to figure this out and I clearly have a gap in my understanding of how this all works.

I am trying to install Wordpress onto a subdomain that I am hosting separately from my domain, via a DreamHost DreamCompute instance (Ubuntu 16.04). I am setting up everything using Trellis and trying to acclimate myself towards Wordpress best practices. I am also using Bedrock / Sage.

So I finally successfully got through all of the steps of setting up Trellis, from Development >> Deployment, but I cannot figure out why it is not working on my production site. (By successful I mean I received no errors via vagrant or otherwise).

*Replaced hostname with blog.example.com / blog.example.dev for clarity

My development site works flawlessly (blog.example.dev), but my production site seems to not be serving any requests (blog.example.com). By this I mean, when I go to blog.example.com or its IP address I am told the page is not working and that it did not send any data. This makes me think there is a problem with how nginx is setup, but clear guess work on my part.

All of the files seem to be in the right location (/srv/www/blog.example.com/current/web) and my nginx conf file seems to be in order:

Ansible managed: /vagrant/roles/wordpress-setup/templates/wordpress-site.conf.j2 modified on 2016-08-06 20:54:59 by vagrant on blog

server {
listen 80;

server_name blog.example.com ;
access_log /srv/www/blog.example.com/logs/access.log;
error_log /srv/www/blog.example.com/logs/error.log;

root /srv/www/blog.example.com/current/web;
index index.php index.htm index.html;

charset utf-8;

add_header Fastcgi-Cache $upstream_cache_status;

include acme-challenge-location.conf;

include includes.d/blog.example.com/*.conf;
include wordpress.conf;

location ~ .php$ {
try_files $uri =404;
error_page 404 /index.php;

include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_pass unix:/var/run/php-fpm-wordpress.sock;

}
}

server {
listen 80;
server_name www.blog.example.com;

include acme-challenge-location.conf;

location / {
  return 301 $scheme://blog.example.com$request_uri;
}

}

The only possibly relevant difference between the development and the production servers, as far as I can tell, is that /srv/www/blog.example.com/current/web is a static location on the development server but it is a relative location (shortcut) on the production server to the most reason deployment (/srv/www/blog.example.com/releases/20160807142536).

I have rebuilt the instance multiple times trying various site configurations, but I can’t seem to pinpoint where I am going wrong.

Again, I am sorry if this is a really stupid mistake, but I appreciate any assistance.

Thank you so much for your time and help!

when I go to blog.example.com or its IP address I am told the page is not working and that it did not send any data. This makes me think there is a problem with how nginx is setup, but clear guess work on my part.

We try not to do guess work here too and we can’t truly help you unless you tell us the precise error you’re seeing and where you’re seeing it (e.g. in browser or in a log file?). Did you search the forum/Google for your specific error? And speaking of log files, did you check your log files for errors?

I have rebuilt the instance multiple times trying various site configurations, but I can’t seem to pinpoint where I am going wrong.

What did you change each time you rebuilt your droplet?

First of all, thank you for taking the time to respond! As for your questions:

We try not to do guess work here too and we can’t truly help you unless you tell us the precise error you’re seeing and where you’re seeing it (e.g. in browser or in a log file?).

So I get no errors upon server setup / deployment via vagrant. My nginx access and error logs for blog.example.com are also blank.

When trying to access the website via browser, I get the following:

Chrome

The blog.example.com page isn’t working
blog.example.com didn’t send any data.
ERR_EMPTY_RESPONSE

Firefox

The connection was reset

The connection to the server was reset while the page was loading.

  • The site could be temporarily unavailable or too busy. Try again in a few moments.
  • If you are unable to load any pages, check your computer’s network connection.
  • If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

Did you search the forum/Google for your specific error?

I have searched far and wide via these forums, Google, and other resources. :slight_smile:

And speaking of log files, did you check your log files for errors?

See above, but willing to check any logs I may not have thought of.

What did you change each time you rebuilt your droplet?

So as far as the droplet (I am assuming DreamCompute’s instances are comparable) is concerned, nothing. I am using the stock Ubuntu 16.04 image and nuking it completely every time I change anything just to be sure.

As for Trellis changes, I have:

  • Provisioned the server via IP / Hostname (as suggested here: err_empty_response)
  • Turned on / off multisite settings in wordpress_sties.yml (production) and the wordpress application.conf (and other changes suggested here: https://roots.io/trellis/docs/multisite/)
  • Enabled / disabled cache-ing (And other attempts to make it as consistent as possible with the Dev site)

I have also modified the server_name / root settings in the nginx config file for this site. I added a wildcard to the server_name and set the root to use the specific “release” folder instead of the relative “current” folder.

And just to reiterate, I wipe and rebuild the droplet / vagrant dev servers between changes and restore the Trellis files via git.

Please let me know if I am not being specific enough!

Which version of Trellis are you using? When was the last time you pulled any changes?

Turned on / off multisite settings…

Are you trying to deploy a multisite install?

So your log files—even the ones specifically listed in the config file you pasted above in your original post—are completely blank?

When you ping blog.example.com and www.blog.example.com do they both resolve to your droplet’s IP address? They should.

Please paste your wordpress_sites.yml file here.

1 Like

I am a moron.

Pinging the website showed me it was trying to reach a local IP address. (192.168.x.x)

At some point I must have put in blog.example.com instead of blog.example.dev in the dev wordpress_site yml. My hosts file contained a vagrant redirect for blog.example.com to the dev site IP.

Removing that from the hosts file allowed me to actually connect and all is well.

So sorry to have wasted your time.

Thank you so much for your help!

1 Like