Failed to point website domain to rails application via virtual host + centos + apache

I have dedicated server hosting in Hostgator. - CentOs 6 64bit - Dedicated server - Apache I had a dedicated host IP address, where I created an β€œA” record with an IP address (domain hosting is located in GoDaddy).

My problem is creating a virtual host application for points in my domain. I am trying to configure a domain. I did not find the conf file in which the document root is configured by default. I tried to modify the conf file in etc / httpd / conf / httpd.conf, but did not use it. One default page is the root document (/ usr / local / apache / htdocs). I need to find the root virtual configuration of the document, and then point my domain to this. I need help with this.

Here is my default virtualhost setting in the httpd conf file:

NameVirtualHost * # Default vhost for unbound IPs <VirtualHost *> ServerName examle_server_name DocumentRoot /usr/local/apache/htdocs ServerAdmin root@example _server <IfModule mod_suphp.c> suPHP_UserGroup nobody nobody </IfModule> </VirtualHost> 

Even if I change the server name to my domain name, there is no chnage. Also, if I delete these lines, it shows the default page, which is located in / USR / local / Apache / HTDOCS.

How / Where can I change this to apply / direct my rails application to the domain.

I also need the Apache VirtualHost configuration of the rails application configuration, which runs on the 3000 port rail

Help me please.

Regards, Ranjit

+6
source share
2 answers

To deploy applications to the server, I use this virtual host configuration

 <VirtualHost *:80> ServerName mydomain.com DocumentRoot /path/to/rails/public/folder <Directory /path/to/rails/public/folder > Options Indexes FollowSymLinks AllowOverride all Require all granted </Directory> </VirtualHost> 

I create a file in /etc/apache2/sites-enabled/mysite.conf , but I do it on Ubuntu servers. I do not know if the location on CentOS matches.

You can create another file, for example, for an application with port 3000.

I skipped Passengger settings ( https://www.phusionpassenger.com/ ) in the file. I use it to work with rails services.

After any changes, you will need to restart the server

 sudo service apache2 restart 
+1
source

Has Apache been installed with easyapache / cpanel? (What often happens with hostgator)
Then your main conf file for your apache will be located at /usr/local/apache/conf/httpd.conf. However, it is not recommended to make changes directly to this file, as it can be overwritten when apache rebuilds its conf files.
For changes not contained in virtualhosts, use the pre and posts files, the location of which will be indicated in the main conf files.
For changes inside virtual hosts, use the file specified for each domain in the conf file to make changes

0
source

Source: https://habr.com/ru/post/985743/


All Articles