0

i tried to migrate a ruby on rails project from a server to another. Everything is pretty much working. Now only mod passenger and apache gives me big problems.

Just as a not - i set the following command else i couldnt start apache "a2enmod mod_access_compat"

Now here is my config file:

LoadModule passenger_module /home/homeuser/.rvm/gems/ruby-2.1.10/gems/passenger-4.0.41/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
    PassengerRoot /home/homeuser/.rvm/gems/ruby-2.1.10/gems/passenger-4.0.41
    PassengerDefaultRuby /home/homeuser/.rvm/gems/ruby-2.1.10/wrappers/ruby
</IfModule>


ServerAdmin ME
ServerName server.ip
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#DocumentRoot /srv/www/vhosts/default/
DocumentRoot /home/homeuser/projectx/public/
# if not specified, the global error log is used
ErrorLog /var/log/apache2/error_log
CustomLog /var/log/apache2/access_log combined
# don't loose time with IP address lookups
HostnameLookups Off
# needed for named virtual hosts
UseCanonicalName Off
# configures the footer on server-generated documents
ServerSignature On



#ScriptAlias /cgi-bin/ "/srv/www/vhosts/default/cgi-bin/"

#<Directory "/srv/www/vhosts/default/cgi-bin">
#    AllowOverride None
#    Options +ExecCGI -Includes
#    Order allow,deny
#    Allow from all
#</Directory>

<Directory "/home/homeuser/projectx/public/">
    #
    Options FollowSymLinks
     AllowOverride All
    Order allow,deny
    Allow from all
    Options Multiviews Indexes
    RailsEnv development
</Directory>

</VirtualHost>

Now the problem. On my other server i can just call the IP of the server, and the rails installation just opens fine.

Here is just goes into the "public" directory and indexes me all its contents.

I know a fix where you can alter the routes within the routes config file:

get '/something', to: 'start#index'

Now i can reach the website via browser if i type the adress: server.ip/something

But like i said - i need a pretty much identical version. So what i need is being able to reach the site via:

server.ip and not server.ip/something

Any help appreciated. Me and my collegues are going crazy about this :-).

EDIT:As an answer to @Aakash Gupta- Actually "something" is just any string i set in the routes file so i can enter the webapp via browser. What i want instead is to enter the webapp just by typing the pure IP of the server into the browser. Without the "something". So lets make an example: If i type into the browser: www.website.com - it doesnt work. But if i set a route in the routes file, as shown above, i can enter the site by e.g. www.website/start.com or www.website/whatever.com. But i really dont want to have to type something after the url as it has effects on other stuff. So i just want to type in the pure domain/ server address which would be website.com. And then the webapp should appear - but instead i just get shown the contents of the public folder, as there is no index file inside. But on my other server mod passenger is clever enough to still start the webapp, even if i set the public folder is a document root. Hope that clarifies my problem. Like i said - i didnt have problems on other servers. : /

Donselm
  • 77
  • 1
  • 8
  • What do you want the behaviour of your app if someone hits server.ip/something ? @Donselm – Aakash Gupta Jan 26 '18 at 18:08
  • You might consider disabling the folder indexing option (not only is it less secure, it's also what's causing your issue)... use `DirectoryIndex` and disable `Indexes`. – Myst Jan 29 '18 at 06:07
  • P.S. see https://stackoverflow.com/questions/2530372/how-do-i-disable-directory-browsing – Myst Jan 29 '18 at 06:08
  • Thanks a lot, that gets rid of the showing indexes. But unfortunatley when i navigate to the site it shows 403 / permission denied. This is really strange as only the root directory www.mainsite.com is affected and cant be opened via browser. All the subsites can be accessed (e.g. www.mainsite/subsite1.com) – Donselm Jan 29 '18 at 13:56

0 Answers0