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/
Related
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>
I would like to configure laravel to whenever a user accesses domain/api he actually accesses the public folder
I have tried the following
1.Created a file laravel.conf with
<VirtualHost *:80>
ServerName ipaddress/api
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/api/public
<Directory /var/www/html/api>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Then
sudo a2dissite 000-default.conf //disabled defaul loading
sudo a2ensite laravel.conf
sudo a2enmod rewrite
sudo service apache2 restart
But now the above fails
But on the virtualHost configuration when i make servername to ipaddress without api whenever i visit the ip address it reads api/public but i would like it to read api/public whenever a user visits
ipaddress/api.
What else do i need to add?
I was following
This tutorial
I'm not an expert on Apache configurations, so I'm not sure what's different between what you have and what the tutorial used.
However, I have a similar setup for my websites, however mine looks a little different:
DocumentRoot /var/www/website/public
<Directory /var/www/website/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Put into context of your configuration:
<VirtualHost *:80>
ServerName ipaddress/api
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/api/public
<Directory /var/www/html/api/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Perhaps give that a try and see if that helps.
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!
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>