So I have a production web server running Apache for a Joomla CMS website with and extensive bespoke Joomla extension and there is a section in the apache.config (below) to set that up for port 80 which runs just fine.
<VirtualHost *:80>
ServerName mydomain
DocumentRoot /var/www/vhosts/mydomain/httpdocs
<Directory /var/www/vhosts/mydomain/httpdocs>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
CustomLog /var/log/apache2/mydomain-access.log combined
ErrorLog /var/log/apache2/mydomain-error.log
LogLevel warn
</VirtualHost>
Since the clone needs to be addressed by ip address the original is updated to replace mydomain with myipaddress
<VirtualHost *:80>
ServerName myipaddress
DocumentRoot /var/www/vhosts/mydomain/httpdocs
<Directory /var/www/vhosts/mydomain/httpdocs>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
CustomLog /var/log/apache2/mydomain-access.log combined
ErrorLog /var/log/apache2/mydomain-error.log
LogLevel warn
</VirtualHost>
And I added a new section to configure the rails app as follows:
<VirtualHost *:3000>
ServerName myipaddress
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
PassengerEnabled on
PassengerRuby /opt/rubies/ruby-2.2.3/bin/ruby
PassengerLogFile /var/log/apache2/passenger.log
</VirtualHost>
I then created a new rails app by running "rails new hello-world" under /var/www/vhosts/mydomain/rails as the user owning the app
After this I ran passenger-config --detect-apache2 to check it looked okay:
$passenger-config --detect-apache2
Looking for possible Apache installations...
--> Looking for /opt/rubies/ruby-2.2.3/bin/apxs2: not found
--> Looking for /usr/local/sbin/apxs2: not found
--> Looking for /usr/local/bin/apxs2: not found
--> Looking for /usr/sbin/apxs2: not found
--> Looking for /usr/bin/apxs2: found
--> Looking for /sbin/apxs2: not found
--> Looking for /bin/apxs2: not found
--> Looking for /opt/ohai-solo/bin/apxs2: not found
--> Looking for /opt/rubies/ruby-2.2.3/bin/apxs: not found
--> Looking for /usr/local/sbin/apxs: not found
--> Looking for /usr/local/bin/apxs: not found
--> Looking for /usr/sbin/apxs: not found
--> Looking for /usr/bin/apxs: found
--> Looking for /sbin/apxs: not found
--> Looking for /bin/apxs: not found
--> Looking for /opt/ohai-solo/bin/apxs: not found
1 symlink duplicate(s) detected; ignoring them.
Analyzing /usr/bin/apxs...
Detecting main Apache executable...
--> Looking for /usr/bin/apache2: not found
--> Looking for /usr/sbin/apache2: found
Detecting version...
--> 2.4.7
Detecting control command...
--> Looking for /usr/bin/apache2ctl: not found
--> Looking for /usr/bin/apachectl2: not found
--> Looking for /usr/bin/apachectl: not found
--> Looking for /usr/sbin/apache2ctl: found
Detecting configuration file location...
--> Looking for /usr/bin/apache2ctl: not found
--> Looking for /usr/bin/apachectl2: not found
--> Looking for /usr/bin/apachectl: not found
--> Looking for /usr/sbin/apache2ctl: found
--> Looking for /usr/bin/apache2ctl: not found
--> Looking for /usr/bin/apachectl2: not found
--> Looking for /usr/bin/apachectl: not found
--> Looking for /usr/sbin/apache2ctl: found
--> /etc/apache2/apache2.conf
Detecting error log file...
--> Looking for /usr/bin/apache2ctl: not found
--> Looking for /usr/bin/apachectl2: not found
--> Looking for /usr/bin/apachectl: not found
--> Looking for /usr/sbin/apache2ctl: found
--> Looking for /usr/bin/apache2ctl: not found
--> Looking for /usr/bin/apachectl2: not found
--> Looking for /usr/bin/apachectl: not found
--> Looking for /usr/sbin/apache2ctl: found
--> Attempting to substitute environment variables in Apache config value "${APACHE_LOG_DIR}/error.log"...
--> Substituted "${APACHE_LOG_DIR}" -> "/var/log/apache2"
--> /var/log/apache2/error.log
Detecting a2enmod and a2dismod...
--> Looking for /usr/bin/a2enmod: not found
--> Looking for /usr/sbin/a2enmod: found
--> Looking for /usr/bin/a2dismod: not found
--> Looking for /usr/sbin/a2dismod: found
--> Looking for /usr/bin/apache2ctl: not found
--> Looking for /usr/bin/apachectl2: not found
--> Looking for /usr/bin/apachectl: not found
--> Looking for /usr/sbin/apache2ctl: found
Found a usable Apache installation using /usr/bin/apxs.
Final autodetection results
* Found Apache 2.4.7!
Information:
apxs2 : /usr/bin/apxs
Main executable: /usr/sbin/apache2
Control command: /usr/sbin/apache2ctl
Config file : /etc/apache2/apache2.conf
Error log file : /var/log/apache2/error.log
To install Phusion Passenger against this specific Apache version:
/opt/rubies/ruby-2.2.3/bin/ruby /usr/bin/passenger-install-apache2-module --apxs2-path='/usr/bin/apxs'
To start, stop or restart this specific Apache version:
/usr/sbin/apache2ctl start
/usr/sbin/apache2ctl stop
/usr/sbin/apache2ctl restart
To troubleshoot, please read the logs in this file:
/var/log/apache2/error.log
$
I was a bit puzzled by the message:
To install Phusion Passenger against this specific Apache version:
/opt/rubies/ruby-2.2.3/bin/ruby /usr/bin/passenger-install-apache2-module --apxs2-path='/usr/bin/apxs'
So I ran the specified command for good measure:
$sudo /opt/rubies/ruby-2.2.3/bin/ruby /usr/bin/passenger-install-apache2-module --apxs2-path='/usr/bin/apxs'
The Phusion Passenger Apache module is correctly installed :-)
Press Enter to learn how to deploy a web app on Apache.
--------------------------------------------
Deploying a web application
To learn how to deploy a web app on Passenger, please follow the deployment
guide:
Phusion Passenger is a registered trademark of Hongli Lai & Ninh Bui.
$
I also ran passenger-config validate-install passenger:
$sudo passenger-config validate-install
What would you like to validate?
Use <space> to select.
If the menu doesn't display correctly, press '!'
‣ ⬢ Passenger itself
⬡ Apache
-------------------------------------------------------------------------
* Checking whether this Passenger install is in PATH... ✓
* Checking whether there are no other Passenger installations... ✓
Everything looks good. :-)
$
And for Apache:
$sudo passenger-config validate-install
What would you like to validate?
Use <space> to select.
If the menu doesn't display correctly, press '!'
⬢ Passenger itself
‣ ⬡ Apache
-------------------------------------------------------------------------
* Checking whether this Passenger install is in PATH... ✓
* Checking whether there are no other Passenger installations... ✓
Everything looks good. :-)
$
However, when I try to access my server from Chrome on my PC via the URL <my-ip-address>:3000 I see a page with:
This web page is not available
ERR_CONNECTION_REFUSED
I wondered if it could be the firewall so I also did a "sudo ufw insert 1 allow 3000" but still no joy.
Can anyone help?