After Install Laravel 4 on Ubuntu 12.04 the requested URL / was not found on this server - laravel

I Installed Laravel 4 on Ubuntu 12.04, I follow these steps from -
http://www.dev-metal.com/install-laravel-4-ubuntu-12-04-lts/
www.dev-metal.com/install-laravel-4-ubuntu-12-04-lts/
Activate mod_rewrite
Install the mod_rewrite module (or extension or whatever it is) and restart the Apache:
sudo a2enmod rewrite
sudo service apache2 restart
Open the default vhost config file:
sudo nano /etc/apache2/sites-available/default
DocumentRoot /var/www
<Directory /var/www>
and change them to
DocumentRoot /var/www/public
<Directory /var/www/public>
than Install Laravel 4
cd /var/www
wget https://github.com/laravel/laravel/archive/master.zip
unzip master.zip && cd laravel-master/ && mv * ../ && cd ..
rm -r laravel-master && rm master.zip
Run the installation with Composer by
composer install
and restart the server:
sudo service apache2 restart
than successfully installed and message :
but when I'm trying to run another web project for example
http://localhost/demo
than error comes like :
Not Found
The requested URL /demo was not found on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80

Add the following to your apache directory configuration.
AllowOverride All

go to the httpd.conf file of the server and remove hash (comment tag) from line showing below
LoadModule rewrite_module modules/mod_rewrite.so
it may be created from server side.

That is because your DocumentRoot is now set to /var/www/public which, i think where your problem is. Try putting your demo project folder inside the public folder then, try again. If it is a route, add it to /app/routes.php

Related

Unable to find a virtual host listening on port 80.... Please add a virtual host for port 80

My web server is set up like this:
AWS EC2 Linux AMI
Apache 2.4
PHP 7
MySQL
Certbot is giving me an error like this when I try to run it:
Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80.
I've looked at other answers people posted on their blogs etc... but they were were not specifically for the EC2 Linux AMI or were made more complicated than they need be.
Most of them seem to have something to do with /sites-available or enabled... but the main .conf file already has a line in it that points to additional .conf files. No need to add a line there.
This all assumes that you have Apache 2.4 installed and are trying to install Certbot.
Make sure A record is set to your IP address in DNS.
cd /etc/httpd/conf.d
sudo nano yourDomainName.conf
Paste, edit, and save the following:
<VirtualHost *:80>
ServerName yourDomainName.com
DocumentRoot /var/www/html
ServerAlias www.yourDomainName.com
ErrorLog /var/www/error.log
CustomLog /var/www/requests.log combined
</VirtualHost>
.
sudo service httpd restart
And with this you should see the virtual host:
httpd -D DUMP_VHOSTS
To install certbot:
cd ~/downloads
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
sudo certbot-auto --apache --debug
Try option 1, "spin up a temporary web server"
I had running nginx on port 80, even setup xamp on port 80, curl on port 80 worked, but it could not find server at localhost
A probable issue with certbot trying to setup and authenticate host with existing servers.
Use of temporary webserver (option 1) worked, ensure no service is running on port 80
I have no httpd service, so I have know such directory and file.
But thanks for the advice before I found the file mydomain.conf in the directory
(in your case you should replace mydomain
/etc/apache2/sites-available and I modified it as it was advised above
sudo nano /etc/apache2/sites-available/mydomain.conf
<VirtualHost *:80> DocumentRoot /var/www/mydomain ServerName mydomain </VirtualHost>
then check for correct
sudo apache2ctl configtest
then restart apache
systemctl reload apache2
and then run certbot
certbot --apache -d mydomain

Docker Windows 403 Forbidden Access after adding a volume to composer

I am new to Docker and I am trying to link up Docker with PHP. So, I follow the tutorial from this article: https://bitpress.io/simple-approach-using-docker-with-php/ and everything ran well.
Unfortunately, when I am trying to add a volume for local development to docker-compose.yml file, I can't open the website. It shows 403 Forbidden: You don't have permission to access / on this server. Apache/2.4.10 (Debian) Server at 192.168.99.100 Port 8080.
My docker-composer.yml:
version: '3'
services:
app:
build:
context: .
dockerfile: .docker/Dockerfile
image: laravel-docker
ports:
- 8080:80
volumes:
- .:/srv/app
Dockfile:
FROM php:7.1.8-apache
MAINTAINER CC
COPY . /srv/app
COPY .docker/vhost.conf /etc/apache2/sites-available/000-default.conf
RUN chown -R www-data:www-data /srv/app \
&& a2enmod rewrite
Vhost:
<VirtualHost *:80>
DocumentRoot /srv/app/public
ServerName foo.example.com
<Directory "/srv/app/public">
AllowOverride all
Require all granted
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Everything work fine when volumes is excluded. I am using Windows 10 Home Basic. Btw, where is the directory of :/srv/app ?
Anyone can help to solve this? Thanks in advance.
/srv/app is the directory on in the docker container.
The volume tag specifies how you want to mount a file system from outside your container to inside your container
<windows machine>:<inside container>
So the definition you have will mount the root directory (where your docker-compose file is) and all subfolders of that directory to the /srv/app directory in the container.
.:/srv/app
Your issue is that the folder you have configured to serve your php pages from, in your vhost.conf file, is /srv/app/public and on your local machine you probably don't have the file public/index.php
It's not that you don't have permissions it's that there is no file to serve.
If you want to check what is in the container you can run docker-compose exec app /bin/bash and poke around inside the container.

Laravel all routes except '/' return 404 on AWS EC2

I'm trying to run Laravel project on AWS EC2. It was working fine until uploaded a new version to deploy. All routes return error 404 except for '/' though all routes exist. httpd.conf in /etc/httpd/conf contains this
<Directory "/var/www">
AllowOverride All
# Allow open access:
Require all granted
</Directory>
I always execute these commands after deploying a new version
sudo chown -R ec2-user /var/app/current
sudo chmod -R 755 /var/app/current
I tried "sudo a2enmod rewrite" but I get "sudo: a2enmod: command not found"
Any solution?
Replacing the instance and re-deploying the app solved the problem
After modifying /etc/httpd/conf/httpd.conf
You need to also restart httpd using sudo service httpd restart
Refer to Laravel ReST API URL 404 not found on AWS EC2 in Apache + mySQL environment - The request URL was not found on this server

mod_proxy missing in apache2 installation

I have an issue with my apache2 configuration for HHVM.
I'm on Debian 7.
The problem is verry simple : mod_proxy are missing in my apache2 installation (/etc/apache2/mod-availables/).
I've reinstall apache2 a several time but nothing do to mod_proxy is still missing, i've try to enable it manually but still the same error.
I must have the mod_proxy and mod_proxy_fcgi files !
Here is the error :
apache2: Syntax error on line 249 of /etc/apache2/apache2.conf: Cannot
load modules/mod_proxy.so into server:
/etc/apache2/modules/mod_proxy.so: cannot open shared object file: No
such file or directory
My apache2.conf is unchanged.
Here is my etc/apache2/sites-available/hhvm.conf
ServerName hhvm.com
DirectoryIndex index.php
DocumentRoot /var/www/dev
ProxyPassMatch ^/(.+\.(hh|php)(/.*)?)$ fcgi://127.0.0.1:9000/var/www/dev/$1 retry=0
The last solution i still have is to compile from source apache2 ...

How to redirect requests from apache2 to tomcat7 on Amazon EC2 Ubuntu12.04 when installed using apt-get command

I installed Apache2 and Tomcat7 on Amazon EC2 Ubuntu12.04 using command:
sudo apt-get install apache2
sudo apt-get install tomcat7
Now for tomcat
CATALINA_HOME is /usr/share/tomcat7 (bin and lib folders of tomcat)
CATALINA_BASE is /var/lib/tomcat7 (webapps folder is in there)
For Apache
Apache modules : /etc/apache2/mods-enabled
virtual hosts : /etc/apache2/sites-enabled
configuration file : /etc/apache2/apache2.conf
Apache configuration file httpd.conf is empty.
How can I redirect all request from Apache2 to Tomcat7?
Means for Example if I enter 10.121.143.116:80 in browser, it will hit 10.121.143.116:8080
Kindly suggest as I am finding on google since last 2 months and found too many solutions all mix up and not able to understand single best working solution.
Hope this will help.
First, create sampleweb file in /etc/apache2/sites-available
sudo touch /etc/apache2/sites-available/proxy_your_sampleweb
Second, add the following in above sampleweb host file.
sudo vi /etc/apache2/sites-available/proxy_your_sampleweb
#For forwarding everything
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
Third, enable sampleweb site
sudo a2ensite proxy_your_sampleweb
Forth, reload apache2 configuration
sudo service apache2 reload
Fifth, access your tomcat app using 80 port.
http://<>/
if you want to redirect only specific context like sampleweb, you can customise the above to limit only your sampleweb request to tomcat.
sudo vi /etc/apache2/sites-available/proxy_your_sampleweb
#For forwarding only required contexts
ProxyRequests Off
ProxyPass /sampleweb http://localhost:8080/sampleweb
ProxyPassReverse /sampleweb http://localhost:8080/sampleweb

Resources