Local laravel web apps are not working properly after Ubuntu (and apache2) upgrade - apache

After upgrading to Ubuntu 14.04 from 13.10, a new version of apache2 (2.4.7) was installed too. I moved all my local web apps from var/www to var/www/html which is the new default apache2 document root on Ubuntu 14.04.
My web apps are developed with Laravel and run on different vhosts like so: example1.dev, example2.dev. So I also changed the DocumentRoot directive in their configuration files with the correct path.
I can access the home page with no problems but any other route returns a 404 error. What do I need to change to fix this?
ps: During upgrade, the apache2.conf file was completely overwritten.

After updating your DocRoot you generally need to update this section also in your vhost files
<Directory "var/www/html/example.dev/public">
Options +MultiViews
AllowOverride All
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
(Just an example)

Related

Passenger directives not working in Apache 2.4 .htaccess

I am trying to load a NodeJS App from Apache+Passenger.
OS: Centos 7 / CloudLinux release 7.9
Apache: 2.4.6 ( httpd-2.4.6-97.el7_9.cloudlinux.x86_64 )
Passenger: Phusion Passenger 6.0.7 ( passenger-6.0.7-1.el7.x86_64, mod_passenger-6.0.7-1.el7.x86_64 ) from Passenger's Yum repo
The virtual host points to /home/vhost1/public_html and the NodeJS App points to /home/vhost1/nodeapps/np1-pass/np1-pass.js
When I run this config via Passenger entries in Apache's config, the application works and is accessible from http://virtual-host/np1-pass/ .
The entry in Apache's config is as under :
<VirtualHost *:80>
ServerName virtual-host
DocumentRoot /home/vhost1/public_html
<Directory /home/vhost1>
# Relax Apache security settings
AllowOverride all
Require all granted
# MultiViews must be turned off
Options -MultiViews
</Directory>
<Directory /home/vhost1/public_html>
# Relax Apache security settings
AllowOverride all
Require all granted
# MultiViews must be turned off
Options -MultiViews
</Directory>
Alias /np1-pass /home/vhost1/nodeapps/np1-pass/public
<Location /np1-pass>
PassengerAppEnv development
Passengerapproot /home/vhost1/nodeapps/np1-pass
PassengerBaseURI "/np1-pass"
PassengerNodejs "/home/vhost1/bin/node"
PassengerAppType node
PassengerStartupFile np1-pass.js
</Location>
</VirtualHost>
What now I have been trying was to move over Passenger directives to the .htaccess file under /home/vhost1/public_html/np1-pass (of-course after removing those directives and the alias and location entry from the Apache config) so that a virtual host owner is able to fire the application without modifying Apache's config, then I get the error
PassengerAppRoot not allowed here, referer: http://virtual-host/np1-pass/
A similar .htaccess works fine for CloudLinux 7 on a cPanel server with Passenger ea-apache24-mod-alt-passenger-5.3.7-9.el7.cloudlinux.x86_64 package installed
When I was looking into various solutions, I came across two documents
https://www.phusionpassenger.com/docs/references/config_reference/apache/#passengerapproot
https://www.phusionpassenger.com/library/config/apache/reference/#passengerapproot
W.r.t. Passenger directives in the 1st link document, under the directive's context .htaccess is missing . But same is present in the 2nd link document
Now I have 2 questions
Are both documents correct or am I missing something. ?
And why the same setup is working fine on CloudLinux 7 on a cPanel server with Passenger ea-apache24-mod-alt-passenger-5.3.7-9.el7.cloudlinux.x86_64 package installed ?
Thanks
Kirti Singh
W.r.t. the question
Are both documents correct or am I missing something. ?
I can't say about that, but I found this useful link https://blog.phusion.nl/2018/01/29/passenger-5-2-0/ which states that many Passenger .htaccess directives have been disabled since Passenger 5.2.0 . But still as both links mentioned in the original question do exist, those links should have had a version prefixed or there should have been a clarification in their content.
Now w.r.t. the 2nd question
And why the same setup is working fine on CloudLinux 7 on a cPanel server with Passenger ea-apache24-mod-alt-passenger-5.3.7-9.el7.cloudlinux.x86_64 package installed ?
I can't say how CloudLinux is doing it, but I was able to run passenger directives via .htaccess by uninstalling the passenger 6.0.7 and the corresponding mod_passenger , and then by installing the old passenger version 5.1 and its corresponding mod_passenger
`yum remove passenger
yum install passenger-5.1.12-1.el7
yum install mod_passenger-5.1.12-1.el7`
This solved my problem and now I am able to load NodeJS apps via .htaccess
I hope my answer helps others who struggle with this issue.

Apache showing empty "index of /", after dist upgrade

I'm working on a Debian 7 server which I did a dist upgrade on so it is Debian 8 now.
The only thing I am having trouble with is the apache2 which got updated from 2.2 to 2.4. the problem that is that now it shows me an empty "Index of /" although there are a lot of files in the specified folders.
vHost Conf:
<VirtualHost *:80>
ServerAdmin some#email
ServerName some.server
ServerAlias some.server
DocumentRoot "/data/apt/public_html"
<Directory "/data/apt/public_html">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Require all granted
</Directory>
</VirtualHost>
How can I get it working again?
mixing 2.2 and 2.4 access directives is not recommended. Look at http://httpd.apache.org/docs/current/upgrading.html. You will see that they never mix Order allow,deny with Require all granted. So remove your Order line.
Mixing old and new directives
Mixing old directives like Order, Allow or Deny with new ones like
Require is technically possible but discouraged. mod_access_compat was
created to support configurations containing only old directives to
facilitate the 2.4 upgrade. Please check the examples below to get a
better idea about issues that might arise.
Also, you do not specify a DocumentIndex file so Apache does not know which file it should return a client when he asks for http://some.server/.
Let's assume the default page is index.html, add this in your VirtualHost:
DocumentIndex index.html
Note 1: ServerAlias has the same value as ServerName, and is therefore not required.
Note 2: you should setup access and error log files for this VirtualHost. It might not be useful if you have only 1 VirtualHost, but you will thank me if you have a large site (with multiple VH later).

How to create an Alias in Apache to a network shared directory?

I'm running Apache 2.2 (on OS 10.9 Mavericks) and have a directory on my NAS (My Cloud EX2100) that I would like to set up with as an aliased web site.
To do so, I've created a .conf file (I called it aliases.conf) in /private/etc/apache2/other (Note that the httpd.conf has Include /private/etc/apache2/other/*.conf added to it).
In my aliases.conf I have
Alias /foo /Volumes/bar/
<Directory "/Volumes/bar">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
I then restart apache and open a browser to go to http://localhost/foo, but I get the error message
Forbidden
You don't have permission to access /foo on this server.
How do I give Apache access to the shared/aliased directory that is on the NAS?
Make sure that the apache user has read permissions to your NAS folder.
Furthermore switch the order of allow and deny to Order deny,allow
I don't know if you have any index files. But if you would like to browse through your directories you have to modify your options entry to: Options FollowSymLinks Idexes
Then restart your apache and try again.

Ruby on Rails on Google Cloud Engine

I deployed a Ruby stack on GCE with Passenger. It was the default click-to-deploy option.
Now to serve my app I placed it in /var/www/app-name/
I edited the virtual host file for the same with this
<VirtualHost *:80>
ServerName app-name
DocumentRoot /var/www/app-name/public
<Directory /var/www/app-name/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
I have edited the host file too to include the IP of the project
Apache still can't serve the Rails app. What am i doing wrong? I am new at cloud hosting and Rails and there is no proper documentation for this to follow.
Any kind of help appreciated :)

Is it possible install Bugzilla into the apache server running collabnet subversion edge

I want to install bugzilla against the apache server that installed with collabnet edge. I've already gotten everything installed, my problem is that I can't figure out which httpd.conf file i need to edit. Collabnet Edge has about 5 conf files, all these files are autogenerated and warn "DO NOT EDIT" in the first line.
Does anyone know how I can do this? if not is it possible to install another [instance]? of apache?
ps: Also this is on windows 2008 server, with IIS shut off.
pps: Also, I am open to the idea of moving my repo to another svn server/issue tracker. as long as it's free and runs on server2008. I just have past experience with bugzilla (as a developer/enduser).
Any thoughts would be appreciated
Yes. It is. First, do not touch any files in the collabnet apache server install. I went ahead and installed a separate installed a separate instance of Apache, which I bound to an non-standard port. I had to add an alias line to the new apache to create Bugzilla as a folder under my main site
NameVirtualHost xxx.xxx.xxx.local
<VirtualHost
xxx.xxx.scgov.local>
ServerName xxx.xxx.xxx.local
DocumentRoot "C:/Apache2.2/htdocs"
</VirtualHost>
<VirtualHost
xxx.xxx.xxx.local>
ServerName xxx.xxx.xxx.local
DocumentRoot "C:/bugzilla"
</VirtualHost>
<Directory "C:\bugzilla">
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit FileInfo Indexes
Order allow,deny
Allow from all
</Directory>
Once this was complete I was able to follow the tutorial at https://wiki.mozilla.org/Bugzilla:Win32Install
Also make sure you install ActivePerl # C:\usr if you don't you have to go in an change every *.cgi file.... read this tutorial on how to install ActivePerl to maximize portability with windows & linux http://www.ricocheting.com/how-to-install-on-windows/perl