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>
Related
I am using AWS Lamp apache service. Here htdocs folder is the default root directory. I have a folder named my-folder inside htdocs.
htdocs
my-folder
I want to set my-folder as a root directory.
But How?
I have edited /opt/bitnami/apache/conf/httpd.conf
Here are the edited codes in httpd.conf file.
# DocumentRoot "/opt/bitnami/apache/htdocs"
# <Directory "/opt/bitnami/apache/htdocs">
DocumentRoot "/opt/bitnami/apache/htdocs/my-folder"
<Directory "/opt/bitnami/apache/htdocs/my-folder">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
But it doesn't work!
Please correct me.
Problem Solved
I just modified /opt/bitnami/apache/conf/vhosts/00_status-vhost.conf as below.
<VirtualHost 127.0.0.1:80 _default_:80>
ServerAlias *
DocumentRoot /opt/bitnami/apache/htdocs/my-folder
<Directory "/opt/bitnami/apache/htdocs/my-folder">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#for https
<VirtualHost 127.0.0.1:443 _default_:443>
ServerAlias *
DocumentRoot /opt/bitnami/apache/htdocs/my-folder
SSLEngine on
SSLCertificateFile "/opt/bitnami/apache2/conf/bitnami/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apache2/conf/bitnami/certs/server.key"
<Directory "/opt/bitnami/apache/htdocs/my-folder">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
and it's working!
Documention provided by AWS Create A Virtual Host For A Custom Application
I have installed laravel on a new EC2 instance and I have ensured that my php, Mysql and apache2 are all running
My Laravel version is 5.2.45
my 000-default.conf is as follows
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/testing/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
my apache2.conf file is as follows
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html/testing/public>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
my folder structure is /var/www/html/testing
But I am getting a 500 when trying to hit the ip..Any help will be highly appreciated.
From my experience, give permissions to your logs files:
sudo chmod 777 -R /var/www/html/testing/storage/
I want my domain to run two separate laravel applications depending the url
for instance
domain.com to /home/sites/1
domain.com/account to /home/sites/2
I have this working, however the laravel instance running on site 2 thinks domain.com/account is the homepage.
When i goto domain.com/account i see the homepage of site 2 - not the route for setup for /account.
here is my vhost file
<VirtualHost *:443>
ServerName domain.com
ServerAdmin webmaster#localhost
UseCanonicalName Off
DocumentRoot /home/sites/1/public/
DirectoryIndex index.php
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /home/sites/1/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Alias /account/ /home/sites/2/public/
<Directory /home/sites/2/public/>
Require all granted
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
</Directory>
</VirtualHost>
Add this to your custom apache virtualhost file
<VirtualHost *:80>
ServerAdmin xx#xxx.com
ServerName xxx.com
DocumentRoot /path/to/site1/public
Alias /account /path/to/site2/public
<Directory /path/to/site1/>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Now you need to change .htaccess file of public folder of the alias -
add RewriteBase /directory_name_of_site2/ right after the RewriteEngine On in .htacess file
you can add as many aliases you want just remember to modify the .htaceess file of every projects
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. :)
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!