Clean URLs are not working in WampServer 3.1.3. How do I fix it? - wampserver

This is uncommented in the httpd.conf file.
LoadModule rewrite_module modules/mod_rewrite.so
When I add this to the httpd.conf file wampserver wont start: AccessFileName .htaccess
How do I enable Clean URLs in WampServer 3.1.3? This is for Drupal 8.

Related

Deploying my rails app on a vps using Passenger and Apache

I followed this walkthrough (https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/el6/deploy_app.html) in deploying my rails app using Passenger but when I try to go to the ip address on my browser, I get a 'This site cannot be reached' error. I had the same problem using Nginx and I switched to Apachebut Im still having the same issue. This is my first deployment and Im really confused right now. Any help will be appreciated. Here's my /etc/httpd/conf.d/cfkmv.conf if it helps
<VirtualHost *:80>
ServerName 144.217.160.59
# Tell Apache and Passenger where your app's 'public' directory is
DocumentRoot /var/www/my_fast_cash/code/public
PassengerRuby /usr/local/rvm/gems/ruby-2.3.1/wrappers/ruby
# Relax Apache security settings
<Directory /var/www/my_fast_cash/code/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
Install passenger and add passenger module in .conf file
Command to install passenger:
sudo apt-get install libapache2-mod-passenger
After installation, they provide code of module installation so add it under your server conf file then restart it.
Code is something like that:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-1.8.7-p374/gems/passenger-4.0.59
PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.8.7-p374/wrappers/ruby
</IfModule>

Passenger 5 is listing public directory

I'm using Centos cPanel with Passenger, the app is working when I access in to the sections for example /home or /login but it displays the files when I access directly to the page /.
This is my .htaccess config
PassengerEnabled On
PassengerLoadShellEnvVars On
PassengerAppRoot /home/claude/rails/claude
PassengerRuby /usr/local/rvm/gems/ruby-2.0.0-p648/wrappers/ruby
RackEnv production
PassengerResolveSymlinksInDocumentRoot on
I already tried disabling autoindex
#LoadModule autoindex_module modules/mod_autoindex.so
but it doesn't let me restart apache.
Does anyone have resolved this issue before?
Thanks.
Done!
So the issue was that I installed first passenger-5.0.10 but for some reason Apache was trying to load passenger-5.0.30 but I was including the other version in httpd.conf so I reinstalled again passenger 5.0.30 and that was it.
Thanks.

Deploying Rails 4 to VPS with cpanel

My steps
I'm trying to deploy my Rails 4 application to subdomain on VPS with cpanel installed.
I added a subdomain msystem.mydomain.com in cpanel GUI. Root directory set to "/home/web/public_html/msystem".
Next I install RVM, ruby 2.1.2, rails 4 and passenger.
Then added
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.45
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.2/wrappers/ruby
PassengerResolveSymlinksInDocumentRoot on
to pre_main_2.conf in cpanel GUI (there is installed only apache 2.2.26).
Then I made all the RVM files world-readable
chmod ugo+rX -R /usr/local/rvm
In the /usr/local/apache/conf/userdata/std/2_2/web/msystem.mydomain.com/msystem.conf I added line
DocumentRoot /home/web/public_html/msystem/public/
Then bundle install --deployment, rake db:migrate.
I used Dave James Miller and blog.barrioearth.com tutorials.
Problem
msystem.mydomain.com/ is redirecting to msystem.mydomain.com/cgi-sys/defaultwebpage.cgi
UPDATE
Apache redirects only '/' request. With other routes it works right way. There is a root route in config/routes.rb:
root 'categories#index'
My virtual host in httpd.conf looks like:
http://pastebin.com/hRgSRD6A
I solved the problem. It was DNS or browser cache issue. On other computers '/' route works well.

Apache: Invalid command 'RailsEnv', perhaps misspelled or defined by a module not included in the server configuration

I'm using Rails 3 + Apache + Passenger, and I'm trying to deploy to a new server. I'm not too familiar with where RailsEnv comes from and am getting this error when checking the syntax of my apache config.
Invalid command 'RailsEnv', perhaps misspelled or defined by a module not included in the server configuration
Does anyone know what module RailsEnv comes from ?
Install Apache passenger module, following the guides here for your specific environment: http://blog.phusion.nl/2011/03/02/phusion-passenger-3-0-4-released/
Then, enable the module using:
sudo a2enmod passenger
Finally restart apache.
For me this was because I copied a linux server config to my mac installation:
<IfModule mod_passenger.c>
LoadModule passenger_module .../mod_passenger.so
PassengerRoot .../locations.ini
PassengerDefaultRuby .../ruby
</IfModule>
Removing the <IfModule> tags fixed it for me. I'm guessing mod_passenger.c doesn't exist on the mac, so then the passenger module is never loaded at all.

Rails Passenger problem with Apache2

I'm trying to setup a ruby on rails server on ubuntu10.10 with apache2 and mod_rails (Phusion Passenger).
I already installed ruby 1.9.2-p0 and rails 3.0.8 and installed Passenger with the passenger-install-apache2-module and the passenger gem (v3.0.7).
It then tells me to add 3 lines to my Apache config file. So I added these lines to '/etc/apache2/apache2.conf':
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/gems/1.9.1/gems/passenger-3.0.7
PassengerRuby /usr/local/bin/ruby
And I edited my '/etc/apache2/httpd.conf' and added:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName 192.168.0.2
DocumentRoot /var/www/webop/public
<Directory /var/www/webop/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
I also found out that the file mod_passenger.so in /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7/ext/apache2/ actually does not exist, its name is mod_passenger.c. But I don't get any errors from that.
The server should only be accessible through a LAN. When I access the server I see all the files and directories in the public folder of my app but the app itself does not get started.
When I restart apache it tells me that mod_rails is already loaded so I guess that passenger is running but I can't figure out why it doesn't start my app!
Thanks in advance!
The reason mod_passenger.so does not exist is because you haven't installed the Apache module. Execute:
passenger-install-apache2-module
This will create the mod_passenger.so file inside your gem directory, and give you three lines to copy into your apache2.conf file.
The passenger module is installed in your current gemset so you shouldn't get any conflicts between projects. You can use any compatible version of Ruby, and any gemset you like, via RVM, and possibly also RBENV. This makes for a nice easy upgrade path from one version of Ruby to the next.
I finally figured out what the problem was: I messed up my ruby installation.
In /usr/local/ I had ruby1.9.2-p0 installed (which was the version I wanted to use) but in /usr/ i had ruby1.8.7 installed.
Passenger was confused which ruby version to use so I changed the LoadModule, PassengerRoot and PassengerRuby paths within apache2/mods-enabled/passenger.load and .config to the correct paths and it finally worked! Both files were created automatically which also caused the problem of a redefinition: On apache startup there was a warning 'mod_passenger already loaded'. So I removed
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/gems/1.9.1/gems/passenger-3.0.7
PassengerRuby /usr/local/bin/ruby
from the apache config and the warning disappeared!
Probably this will help someone else some day!
I have come across a cleaner solution today. This might help future users. The command -
passenger-install-apache2-module
tells me to put these three lines in apache configuration file.
LoadModule passenger_module /home/anwar/.rvm/gems/ruby-2.2.0/gems/passenger-4.0.59/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/anwar/.rvm/gems/ruby-2.2.0/gems/passenger-4.0.59
PassengerDefaultRuby /home/anwar/.rvm/gems/ruby-2.2.0/wrappers/ruby
</IfModule>
But, where is that configuration file? The answer is the configuration files are seperated into many pieces and they reside in /etc/apache2/mods-available.
So you should do three things -
Create a file ending with .load in /etc/apache2/mods-available folder. I used passenger.load.
Paste the three lines in that file and save the file.
Now in terminal use sudo a2enmod <module-conf-filename> to enable the module. In my case, the file was, passenger.load. So, I used
sudo a2enmod passenger
Now, restart the server and use the command apache2ctl -M to find that passenger module is enabled.
I think they want you to put those three lines in your httpd.conf file, not in your apache2.conf. At least that's how I've always done it.

Resources