简体   繁体   中英

How can I deploy Apache, Rails App, and phpMyAdmin on the same Server?

now I'm running rails app on Apache. My rails app is placed at /var/www/html/railsapp/ and its written in httpd.conf. It completely works fine and show app when I access to http://example.com/

One more thing that I want is "phpMyAdmin" beside rails app. phpMyAdmin is currently installed at /usr/share/phpMyAdmin

I created phpMyAdmin.conf in /etc/httpd/conf.d in which, I wrote those below

Alias /phpmyadmin/ "/usr/share/phpMyAdmin/"
<Directory "/usr/share/phpMyAdmin/">
  Options -Indexes FollowSymLinks MultiViews Includes ExecCGI
  AcceptPathInfo On
  AllowOverride All
  Allow from all
</Directory>

After restarted Apache, it still shows rail's routing error when I try to access http://example.com/phpmyadmin

It seems rails recognize "phpmyadmin" part as rail's controller name. Can anyone help me about this?

I want to access to phpmyadmin when I go to example.com/phpmyadmin and I wanna access to rails app when I go to example.com

Thanks!!

It works for me when I Added the below line in /etc/apache2/httpd.conf

<VirtualHost *:80>
ServerName mysql.yourservername.com
<Directory "/usr/share/phpMyAdmin">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

have a look at this

To sum it up, you have to modify your httpd.conf :

  • set rewrite rules on
  • set up an url rewrite condition that matches requests on your php file
  • have a rewrite rule to let default server rules handle the request, instead of rails' router

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM