Cannot navigate to laravel project via localhost using Apache - php

I installed a laravel project to /home/user/development. The project is called rpm (/home/user/development/rpm). I also have another project that I have been using at /home/public_html. It's called mgmt (/home/user/public_html/mgmt). I can navigate just fine to mgmt via localhost/mgmt. It's conf file in sites-available is
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/user/public_html/
<Directory /home/user/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>
Now my laravel project (rpm) does not work. Navigating to localhost/rpm gives a 404.
It's conf file looks like this
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/user/development/rpm/public/
Alias /rpm /home/user/development/rpm/public
<Directory /home/user/development/rpm/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>
What could be the problem here? Both of those config files have symlinks in the sites-enabled folder.

Modify the first conf to this. Discard the second conf.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/user/public_html/
Alias /rpm /home/user/development/rpm/public
<Directory /home/user/public_html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /home/user/development/rpm/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/rpm-error.log
CustomLog ${APACHE_LOG_DIR}/rpm-access.log combined
</VirtualHost>

Related

Unable to connect to apache virtualhost

I have unizped codeigniter on /var/www/control_cuotas indx.php is placed on that folder and I settrd up a new virtualhost on apache on the 000-default.conf file whith this code
<VirtualHost *:81>
<Directory /var/www/control_cuotas>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/control_cuotas
ServerAlias www.control_cuotas.test
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
But I cannot acces to localhost:81 its Unable to connect and the serve rwas restarted before I tried to access
For example:
<VirtualHost *:80>
ServerName your_project
DocumentRoot "C:/wamp64/www/your_project"
<Directory "C:/wamp64/www/your_project/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Let's try one more time.
Make sure all your VirtualHosts define a ServerName. Failure to do so will mean trouble as you add more hosts.
<VirtualHost *:80>
DocumentRoot /var/www/control_cuotas
ServerName control_cuotas.test
ServerAlias www.control_cuotas.test
ServerAdmin webmaster#localhost
<Directory /var/www/control_cuotas>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Don't forget to enable the above config in Apache adding it to the sites-enabled list. Then restart Apache.
The file /etc/hosts should look like this at a minimum
127.0.0.1 localhost
127.0.0.1 control_cuotas.test
127.0.0.1 www.control_cuotas.test
Other VHosts should also be represented in this file.
You can also add entries for ipV6 if you want, but it is not a requirement in most cases. (The main case is that you have disabled communication using ipV4.)

when i enter domain name http://oj.mbstu.ac.bd into browser then next it redirect to IP http://103.28.121.75/index.do why?

<VirtualHost *:80>
ServerName oj.mbstu.ac.bd
ServerAlias www.oj.mbstu.ac.bd
ServerAdmin webmaster#oj.mbstu.ac.bd
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
/etc/hosts
127.0.0.1 oj.mbstu.ac.bd
103.28.121.75 oj.mbstu.ac.bd
<VirtualHost *:80>
ServerAdmin yourname#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
This is the proper configuration, but as i can see your document root /var/www/ includes the html, just remove the conf document and include you own index.
Then just restart the apache server
sudo service apache2 reload

laravel project not loading css with apache artisan serve working fine

I've created a Laravel Project, which I have deployed previously with apache2, and working great.
As I finished with my latest deployment, I found that no external CSS was being loaded when I was done with. So I did a check on all step many times over, but I don't think I have missed on anything.
However, upon running with php artisan serve everything works fine.
Here is my virtual_host config file:
<VirtualHost *:80>
ServerAdmin admin#project
DocumentRoot /var/www/html/project/public/index.php
ServerName example.com
ServerAlias www.example.com
DirectoryIndex index.php
<Directory /var/www/html/project/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
In virtualhost configuration, you should try using
<VirtualHost *:80>
ServerAdmin admin#project
DocumentRoot /var/www/html/project/public
ServerName example.com
ServerAlias www.example.com
DirectoryIndex index.php
<Directory /var/www/html/project/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Remove public folder from <Directory> and also remove index.php from DocumentRoot.

Xampp is not recognized VirtualHost after few attempts?

I had installed xampp few years ago. But now I have a little problem with the configuration of the vhost.
I have 4 different pages in my server, the apache is running with the port 80. So my configuration to the vhost is as following:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:/xampp/htdocs/paginasweb/munkys
ServerName www.munkys.com.co
<Directory "C:/xampp/htdocs/paginasweb/munkys">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:/xampp/htdocs/paginasweb/flinda
ServerName www.flinda.com.co
<Directory "C:/xampp/htdocs/paginasweb/flinda">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:/xampp/htdocs/paginasweb/pluxpc
ServerName www.pluxpc.com.co
<Directory "C:/xampp/htdocs/paginasweb/pluxpc">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:/xampp/htdocs/paginasweb/conradoarte
ServerName www.conrado-arte.com.co
<Directory "C:/xampp/htdocs/paginasweb/conradoarte">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>
My problem is the following:
When I tried to join to my website, www.conradoarte.com.co, the page is loading outside the local network but after a few minutes or attempts the dns is lost, but if I join to the website inside my local network the page is up. After reload the page from my local network I can see again the page outside the local network.
I don't know what is the real problem.

Virtual host, apache2 and aws no access

Created a instance in aws with ubuntu 14:04 server, installed and configured my apache2 virtual hosts as follows:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName magento.com
ServerAlias www.magento.com
DocumentRoot /var/www/magento.com/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/magento.com/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<VirtualHost>
and
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName recomendador.com
ServerAlias www.recomendador.com
DocumentRoot /var/www/recomendador.com/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/recomendador.com/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<VirtualHost>
My files are in:
/var/www/magento.com/public_html/
/var/www/recomendador.com/public_html/
My /etc/hosts :
127.0.0.1 localhost
127.0.0.1 magento.com
127.0.0.1 recomendador.com
When I access my aws:
http://meu_ip/
Opens magento, when I access:
http://meu_ip/recomendador.com
or
http://meu_ip/www.recomendador.com
Appears was not found on this server.
If I type:
http://meu_ip/magento.com
or
http://meu_ip/www.magento.com
That is, it seems he only recognizes the magento and still no use ServerName or ServerAlias.
I enabled both the a2ensite
Anyone know what might be wrong?
Thanks

Categories