Have the below config in vhosts. Its always returns 500 error when i run it through MAMP. Not sure what is wrong. Stopped mamp and ran it using valet. laravel website runs successfully. Permissions of bootstrap/cache and storage looks good. Error logs are empty cant debug and debug setting set to true in .env file. Only access log exists with 500 error. Below is the vhosts config that i have for MAMP. Other website in vhosts file work.
<VirtualHost *:80>
ServerName elearn.localhost
ServerAlias elearn.localhost
DocumentRoot "/Users/user1/code/elearn/public"
ErrorLog "/Users/user1/logs/elearn.localhost-error_log"
CustomLog "/Users/user1/logs/elearn.localhost-access_log" common
<Directory "/Users/user1/code/elearn/public">
DirectoryIndex index.php
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
Satisfy Any
</Directory>
</VirtualHost>
What version of Laravel are you using, if it is 5.6 make sure you're running PHP at at least 7.1 in MAMP - fallen foul of that myself a couple of times?
Alrighty, checklist:
is MAMP running under your user?
make sure it's not permissions issues: commit, chmod 777 on project root, try again, if you still get 500 then it's ruled out
stop valet, restart mamp, just to be sure no services parts are conflicting
remove the vendor folder and composer install again, better be safe then sorry
lastly, add a dd() to any route and test it, if you see the dd, means it's not related to mamp, valet or laravel, probably config, driver or other issues.
Related
I was testing a clean Laravel 6 installation to migrate an old Laravel project in one Ubuntu 18.04 environment, no used with PHP projects before.
After install PHP, Apache, Mysql... I test one PHP page OK.
I set the permissioins to 777 in /var/www/html/ subdirectories.
I cloned my old Laravel App to migrate and did one clean Laravel 6 installation.
First, I loaded the default welcome page in Laravel 6. After, I put some routes and views from the old project and tried to load some of then, but I had errors of type:
page don't found
I checked the settings of Apache and if mod_rewrite was available... finally, I run the old project OK, but my Laravel 6 is dissapeared. I can see it in the disk, but if load the http://localhost/laravel/ directory I can't see it.
Edited
Content of /etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
What i can suggest you to try is to define one Virtual Host for each project in this way:
Put this (with proper information) inside /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
DocumentRoot "/var/www/html/YOUR_LARAVEL_PROJECT_ROOT/public"
ServerName yourProjectDomain.dev
<Directory "/var/www/html/YOUR_LARAVEL_PROJECT_ROOT/public">
AllowOverride All
Options FollowSymLinks +Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And inside /etc/hosts put
127.0.0.1 yourProjectDomain.dev
Then check the permission on /var/www/html and each subdirectory (you can use cd /var/www/html && sudo chmod -R 777 * to set everything as readable, writable and executable).
Then clear the cache of the project (delete all the files inside the bootstrap/cache folder).
Then you should be able to access that project just using yourProjectDomain.dev on every browser inside your pc.
I install LAMP on my droplet in digital ocean, it did works good but now just tell "this site can't be reached, refused to connection" my IP is 157.230.139.112
My project worked well, however, from one day to the next, that simply appeared. I did not have anything important and decided to delete it and create a new droplet, however the same thing happens, I can make migrations and connect with the bd but only rejects the connection.
I did install composer, all the packages, configure my db and my etc/apache2/sites-enabled/000-default.conf and point to the public folder.
Am I doing something wrong?
Your apache server block might not be pointing to your laravel location correctly.
So, you might try configuring Apahce2 site configuration file for Laravel.
Run the command below to create a new configuration file called laravel.conf
sudo nano /etc/apache2/sites-available/laravel.conf
Copy paste the content below into the file and save it. Remember to replace 'Mywebsite' with your own domain name and directory root location.Remember to point to laravel public folder for security.
<VirtualHost *:80>
ServerAdmin admin#MyWebsite.com
DocumentRoot /var/www/html/MyWebsite/public
ServerName example.com
<Directory /var/www/html/MyWebsite/public>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save the file and exit.
Enable the Laravel and Rewrite Module
Enable the VirtualHost by running ..
sudo a2ensite laravel.conf
sudo a2enmod rewrite
Alternatively, compare your localhost apache serverblock configuration with that on the server, ie. if you are running apache locally
I'm starting to learn how to set up a lamp on a vps, and i'm trying to run a laravel project.
This is my 000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
Alias /laravelproject /var/www/laravelproject/public
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
I'm trying to access using the /laravelproject and it works cause i'm redirected to a login page ip/laravelproject/login (like I set using the middleware for not logged users and it works on my local homestead virtual machine). But i got a 404 file not found error. Not a pretty designed laravel one, but a raw and ugly server error
Not Found
The requested URL /laravelproject/login was not found on this server.
Apache/2.4.10 (Ubuntu) Server at '' Port 80
Of course i don't have any laravelproject.com domain to set up, i want to access it simply with my_server_ip/laravelproject.
How can i set up a virtualhost or an alias to run it with all the routes working?
You could also try enabling apache mod-rewrite if not enabled yet.
sudo a2enmod rewrite
sudo systemctl restart apache2
You'll need to make sure the /var/www/laravelproject/public directory is set to AllowOverride All (which I believe you have taken care of by setting /var/www to All). Then make sure the .htaccess file in your public directory is correctly set up: https://github.com/laravel/laravel/blob/master/public/.htaccess
this is because Apache is looking for /public/login/index.html which is not a file. Laravel's .htaccess redirects these requests appropriately, but it has to be in your public folder and Apache has to AllowOverride
edit:
<Directory /var/www/laravelproject/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
I know there are a lot of posts on this issue but none of them address the issue I'm having. I am trying to set up a virtual machine following a tutorial on Lynda.com.
Host is a Surface Pro 2 running Windows 10, guest is Virtual Box 5.0.4 with Ubuntu 14.04.3 LTS. People have had a lot of issues with VirtualBox on Windows 10 but mine installed just fine, I have made it all the way to installing Apache, MySQL etc and I'm able to access the Apache2 server status page on my local browser. I don't seem to be having any port issues and I've followed the tutorial's instructions which were step by step.
The issue I'm having is that I can't access the shared folder. I'm ready to configure PHP and I can't access a file placed in the shared folder, even though I've followed all the directions exactly. The shared folder shows up in the VM manager console with the correct path, but when I place a file in the shared folder and try to hit it through the browser on the host machine I get a 404 error. I've gone over the steps to configure the apache server several times, and it looks like I have everything correct:
**blakers**#sandbox:~$ cd /media/**sf_vbsandbox**
blakers#sandbox:/media/sf_vbsandbox$ id
uid=1000(blakers) gid=1000(blakers) groups=1000(blakers),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin), 109(sambashare),**999(vboxsf)**
blakers#sandbox:/media/sf_vbsandbox$ **getent group vboxsf
vboxsf:x:999:blakers,www-data**
This is from sites-available/vboxsf.conf:
<VirtualHost *:80 *:8282>
ServerName sandbox
ServerAlias *.dev
LogLevel info
ErrorLog ${APACHE_LOG_DIR}/dev-error.log
CustomLog ${APACHE_LOG_DIR}/dev-access.log combined
RewriteEngine On
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /media/>
Order allow,deny
Allow from all
Require all granted
<Location /server-status>
SetHandler server-status
Order allow,deny
Allow from all
Require all granted
</Location>
UseCanonicalName Off
VirtualDocumentRoot /media/sf_%1
</VirtualHost>
Any help would be awesome!!
hi the problem is in this line :
VirtualDocumentRoot /media/sf_%1 , change this folder to be named like the folder that you are sharing. if its called "vbsandbox" then sf_vbsandbox.
you can confirm by:
ls -la /media/
then the folder name will be there.
you will have to restart apache at the end
sudo service apache2 restart
I have just been trying to setup a local apache server on osx. Everything was going well until I enabled vhosts.
When I navigate to a site setup in vhosts (local.dev) all I get is a 403 forbidden error saying you do not have permission to access / on this server.
The route of the site in question is '/www/local/public/'. The folder path exists and running apachectl -S and the syntax of the vhosts file was correct.
I have looked at the permissions of the folder and have even tried setting everyone to read and write, but no luck. I have set my permissions on the folder to read/write as well as permissions for the _www group.
If you have any ideas on where I am going wrong that would be much appreciated!
I have looked for a few answers on here but not been able to find anything that has worked for me.
Looking at the default document root for apache, the only permission I have missing on the /www/ folder is for an account called 'system'. I am unable to add this system account to the permissions of the folder as it does not appear in the get info option on the folder.
Thanks,
Joe
As with all of my questions it seems, I have found an answer!
I managed to get everything working smoothly by adding the following to my /private/etc/apache2/extra/httpd-vhosts.conf file inside of the <VirtualHost *:80> that was setup for local.dev
<Directory "/www/local/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
So the overall vhosts config for local.dev would look like the following:
<VirtualHost *:80>
DocumentRoot "/www/local/public"
ServerName local.dev
<Directory "/www/local/public">
... Above code here ...
</Directory>
</VirtualHost>
I added this, then restarted apache, and everything worked smoothly.