Unable to change the document root of https://localhost/ - php

I went to /etc/apache2/sites-available/default-ssl and updated the document root when it is accessing ssl. However, for some reason, it's still pointing to /var/www. I have reloaded and restarted apache2 server using sudo service apache2 reload and sudo service apache2 restart but the changes are still not reflecting. Are there other places that I need to change to make the https://localhost/ points to /home/student/public_html?
The first few lines of default-ssl:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin temp#temp.com
ServerName localhost
DocumentRoot /home/student/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/student/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
The first few lines of default:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/student/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/student/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Redirect "/" "https://localhost/"

I deleted all browser history and it starts working now. :)

Related

Laravel 8 404 api routes in production

I have never had this issue before, it was working perfectly and after I reinstalled the server I now got a 404 when I call my 0.0.0.0/api/students/show.
I did composer production call on SSH to create latest autoloader. Cleared the cache for php artisan, the normal steps to setup a Laravel production app. But I still get 404 when I call the API endpoint.
Maybe the problems is something with chmod rights? Storage, etc. is already done...
In your apache2.conf make sure you've AllowOverride All and not AllowOverride none.
Example
<Directory /var/www/html/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Original Answer
You should not need to write Directory at all.
This is my working page custom .conf file on sites-available folder:
<VirtualHost *:80>
ServerName matiaslauriti.dev
ServerAlias www.matiaslauriti.dev
Redirect 301 / https://matiaslauriti.dev
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName matiaslauriti.dev
ServerAlias www.matiaslauriti.dev
DocumentRoot /var/www/html/public
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/matiaslauriti.dev/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/matiaslauriti.dev/privkey.pem
</VirtualHost>
</IfModule>
What I do have on my apache2.conf is default, I did not change anything:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options +FollowSymLinks -Indexes
AllowOverride All
Require all granted
</Directory>

Unable to access my virtual host from the same network using IP address

I'm trying to run two different sources in xampp (one for admin one for users).
I have found one solution by using httpd-vhosts.conf.
In C:\xampp\apache\conf\extra\httpd-vhosts.conf file I have added below config.
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\project\user\www"
ServerName 192.169.9.99
<Directory "C:\xampp\htdocs\project\user\www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\project\admin\www"
ServerName 192.169.9.99.co
<Directory "C:\xampp\htdocs\project\admin\www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Now, I can able to see user and admin pages running in 192.169.9.99 and 192.169.9.99.co
But, here my problem is, I tried with another system that present in my same network.
It has given proper result for 192.169.9.99 but not for 192.169.9.99.co
192.169.9.99.co redirecting to 99.co website.
Where I did wrong, Is I missed anything?
There are any other solutions for achieving this requirement?
Is this possible to achieve this?Thanks.
#Start
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\project\admin\www"
ServerName 192.169.9.99.co
<Directory "C:\xampp\htdocs\auction\frontend\www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
#next
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\project\user\www"
ServerName 192.169.9.99
<Directory "C:\xampp\htdocs\auction\frontend\www">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
192.169.9.99 Will be found earlier because the match.
VirtualHost *:80
192.169.9.99
192.169.9.99.co
I have added "Listen 8081" in httpd.conf, so that now my xammp will listen 80 and 8081 ports.
In httpd-vhosts.conf I have added
<VirtualHost *:8081>
DocumentRoot "C:\xampp\htdocs\project\admin\www"
</VirtualHost>
Document root for port 80 will taken from httpd.conf file.
Now I tried with another system that in my network, on 192.169.9.99 My user site is running.
In 192.169.9.99:8081 My admin site is running.

How to run Django and Php on one Apache2?

I want to run my Django app and mediawiki at same domain on one Apache2.But I find there is a problem hard to solve.
In my config, localhost and localhost/mediawiki can normal access, but when I access to localhost/dblog(It's my Django app's directory), browser shows "Bad Request (400)".
I trid to google and another related questions at stackoverflow, but still can't solve this problem.
Here is my Apache2 config:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
ServerName localhost
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www>
Options ALl
AllowOverride All
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess dblog python-path=/var/www/dblog:/usr/lib/python2.7/site-packages
WSGIProcessGroup dblog
WSGIScriptAlias /dblog /var/www/dblog/dblog/wsgi.py
<Directory /var/www/dblog>
Options +ExecCGI
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
</VirtualHost>
Thank you!

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

Virtualhost Apache, Rails and PHP

I am trying to have a Rails application to coexist on one server along with a PHP page. I am using Apache installed through Passenger.
So, I have created a virtualhost file for my php page, and it is as such:
<VirtualHost *:80>
ServerAdmin mail#mail.com
ServerName subsite.site.com
DocumentRoot "/var/www/subsite"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/subsite">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
My problem is that this mysite.site.com keep being redirected to the main rails site. Any idea?

Categories