Can't get Laravel 4.2 to work / 404 - apache

I've tried installing and reinstalling and going through dozens of possible solutions and nothing has worked.
I installed Laravel 4.2 to /var/www/project.
I then created a new virtual host:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/project/public
<Directory /var/www/project/public>
# Don't show directory index
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And enabled it with:
sudo a2ensite project.conf
And restarted apache2. However, when I go to my domain, all I get is a 404:
Not Found
The requested URL / was not found on this server.
What am I doing wrong?

Fixed.
I had to:
sudo a2dissite 000-default.conf

If you are using Linux, add this
ServerName projectname
below <VirtualHost>
Add the line
127.0.0.1 projectname
to the etc/hosts file. So it should work without having to disable other sites.
Restart your apache and test it with http://projectname.

Related

Site Does Not Exist: Flask app on Apache 2.4.29 Ubuntu 18.04

I have looked at all the previous StackOverflow questions regarding this problem but cannot seem to find a solution in any of the answers.
When I run the command:
sudo a2ensite WebApp
I receive:
ERROR: Site WebApp does not exist!
This is my file /etc/apache2/sites-available/WebApp:
<VirtualHost *:80>
ServerName 192.168.1.107
ServerAdmin email#mywebsite.com
WSGIScriptAlias / /var/www/WebApp/WebApp.wsgi
<Directory /var/www/WebApp/WebApp/>
Require all granted
</Directory>
Alias /static /var/www/WebApp/WebApp/website/static
<Directory /var/www/WebApp/WebApp/website/static/>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I copied that almost verbatim from tech with tim's tutorial.
Except I added the correct file paths and changed
Order allow,deny
Allow from all
to
Require all granted
Does anyone have any suggestions?
You should run
sudo a2ensite CSCI430_CTF1
instead of
sudo a2ensite WebApp

How to install existing prestashop on localhost with APache2? Having pb configuring .conf and virtual hosts

After installing XAMPP, I downloaded the project code and the SQL database:
1) I downloaded the database on phpmyadmin
2)copied the project in var/www/html
Now I am trying to configure Apache2, going through etc/apache2 by adding a file in sites-available containing:
<
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule mod_dir.c>
DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
</IfModule>
then disabled the default and enabling mine.
But when I go on localhost:8000, there is no connection and the database seems to be on port 3306.
Could you help me understand better what should I do or what I am doing wrong? Thank you!

MAMP - Document root wont work properly

MAMP - Document root won't work properly It only display one of my other projects, even If I change the root directory to my current project it just displays the same project as before. I can't change it at all no matter what I do, I have reinstalled MAMP 4 and MAMP 3. No matter what I do there is the same problem? CAN ANYONE HELP!!
This not DocumentRoot issue it's Directory issue because of MAMP use Apache 2.2.32. Apache2.2 and Apache2.4 are different Vhost format. MAMP version history.
Apache 2.2 Vhost format:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Applications/MAMP/Library/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
Apache 2.4 Vhost format:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "/Applications/MAMP/Library/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
<Directory "/Applications/MAMP/Library/docs/dummy-host2.example.com">
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
Apache Vhost format reference.
If you use MAMP your issue will not solve. Try Apache 2.4. If you are Windows user then use XAMPP or WAMP. If you are Mac user then use XAMPP.

Homestead with subdomains

I use homestead and Laravel 5.4 and I need to enable sub-domains, in my main windows 10 machine I added a hosts in (C:\WINDOWS\system32\drivers\etc\hosts) record :
192.168.10.10 myapp.dev
192.168.10.10 website.myapp.dev
so this works ok, when I navigate to website.myapp.dev it displays homepage as if I go to myapp.dev, and also my homestead server is apache2 not nginx
In this route when I go to website.myapp.dev I get the expected output (website.myapp.dev) in the log:
Route::get('/', function(Illuminate\Http\Request $request){
\Log::info($request->fullUrl()); // logs website.bikser.dev
});
however my this route is not firing up when I go to website.myapp.dev :
Route::domain('{account}.myapp.dev')->group(function () {
Route::get('/{account}', 'WebsiteController#view');
});
So I need this route to work so I could use sub-domains , I didn't change anything in .htaccess file coz I don't know if I should and also I tried to edit apache2.conf and add this lines:
<VirtualHost *:80>
ServerName myapp.dev
ServerAlias *.myapp.dev
</VirtualHost>
but still my {account}.myapp.dev route does not fire up , pls help
EDIT:
just added this code as was suggested by : #headmax, but when I navigate to myapp.dev it says
NotFoundHttpException , this is the code that I added :
<VirtualHost *:80>
ServerName myapp.dev
DocumentRoot home/vagrant/code/public
<Directory "home/vagrant/code/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
#Require local
Require all granted
</Directory>
</VirtualHost>
First change the right of your new doc root :
sudo chown -R $USER:$USER home/vagrant/code/public
Note: The default Apache configuration in Debian 8 requires that each
virtual host file end in .conf.
We copy the default vhost for your own site.conf 000-default.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/myapp.dev.conf
You need to edit the file and add here your virtualhost paste
sudo nano /etc/apache2/sites-available/myapp.dev.conf
We need the simple way look like this :
<VirtualHost *:80>
ServerAdmin admin#myapp.dev
ServerName myapp.dev
ServerAlias www.myapp.dev
DocumentRoot /home/vagrant/code/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Now that we have created our virtual host files, we can enable.
sudo a2ensite myapp.dev.conf
Output: Enabling site myapp.dev. To activate the new configuration,
you need to run: service apache2 reload
Restart Apache
service apache2 reload //to reload configuration
sudo systemctl restart apache2 //to apply the configuration change
Now your are done test the site.
You need a root directory to tell apache where are stored you site files.
Here example myapp.dev is a folder and the public folder are (a child) where public files stored.
<VirtualHost *:80>
ServerName myapp.dev
DocumentRoot home/vagrant/code/public
<Directory "home/vagrant/code/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
#Require local
Require all granted
</Directory>
</VirtualHost>

Redmine Install, only seeing file and folders. Possible Apache config issue

So I tried to install redmine following the official instructions here:
http://www.redmine.org/projects/redmine/wiki/redmineinstall
And managed to successfully run with webrick (Step 9). After that (the machine is using Debian) I used this guide:
http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_210_on_Debian_Squeeze_with_Apache_Passenger
To "serve up" redmine. However after doing all of that I only see a list of files and folders. Here is the 000-default.conf that has the redmine configuration:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RailsEnv production
RailsBaseURI /redmine
<Directory /redmine>
Options FollowSymLinks
Order deny,allow
PassengerResolveSymlinksInDocumentRoot on
AllowOverride all
Allow from all
RailsBaseURI /redmine
Options -MultiViews
</Directory>
</VirtualHost>
This is just the latest config I tried since I have added every option that I could come up with to try to get it to work. I would appreciate any help on the matter.
Change your directory path:
<Directory "/redmine/public/">
See further information on Redmine at http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Apache_to_run_Redmine
I had this problem, after much searching this worked - add to your Apache configuration the line:
PassengerAppRoot /opt/redmine
(change the path to where you unziped the redmine files)
See here for explanations:
https://www.phusionpassenger.com/library/config/apache/reference/#passengerapproot