2

Looking for help on server problem. I have followed the following steps to set up LAMP on the VM

https://cloud.google.com/community/tutorials/setting-up-lamp

I put my Laravel 5.4 website onto the VM, configure the .env for the following:

APP_URL=website_external_IP

But when I access the website by inserting the website_external_IP on my browser, it returns the following image.

Sorry for being noob of server problems but please let me know what else information should I provide for you to figure out the cause of it. Thank you!

qwe

1 EDIT:

In response to John Hanley's suggested site. I further made the following edits on the apache conf:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/laravel_project.conf
sudo vim /etc/apache2/sites-available/laravel_project.conf

and there vim the laravel_project.conf as followings

NameVirtualHost *:8080
Listen 8080
 
<VirtualHost *:8080>
    ServerAdmin admin@example.com
    ServerName laravel.dev
    ServerAlias www.laravel.dev
    DocumentRoot /home/user/projects/laravel_project/public
     
    <Directory /home/user/projects/laravel_project/public/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
            Require all granted
    </Directory>
     
    LogLevel debug
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

then

sudo vim /etc/hosts

and add the following line:

127.0.0.1 laravel.dev

then disabled the original conf settings and enable for my site:

sudo a2dissite 000-default.conf
sudo a2ensite laravel_project.conf

Without having the full understanding of the new edits procedures, accessing the page with IP returns the following error:

You don't have permission to access / on this server.

Community
  • 1
  • 1
warmjaijai
  • 991
  • 4
  • 13
  • 30

1 Answers1

0

Your Apache web server has directory browsing enabled. Also you do not have a default page present (or enabled) therefore you server is serving up the directory listing.

/etc/apache2/apache2.conf

Remove the word Indexes from this part of your configuration:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        ...
</Directory>
John Hanley
  • 74,467
  • 6
  • 95
  • 159
  • Thanks John. I removed `Indexes` and restarted Apache. Now the page turns to `You don't have permission to access / on this server.` I also followed https://stackoverflow.com/questions/30639174/file-permissions-for-laravel-5-and-others to change the ownership of the folders and files. – warmjaijai Oct 19 '18 at 03:53
  • You don't have a default page. What is your home page filename? If you look in the file `/etc/apache2/mods-enabled/dir.conf` under ` ` you will see the list of default filenames that Apache will search for. I would look at the file `readme.md` for details on how to configure your setup. – John Hanley Oct 19 '18 at 04:01
  • Thanks for your suggestions. I went into readme.md but doesn't seem to show any clues. In Laravel I dont see index.php at the root and i think all the frontend files are in `/resources/views`. Under development, I would run `php artisan serve` in CLI so that I can directly access the website by putting `localhost:8000` into my browser without any further work done. So I guess if it works under development without the index.php at root then there should be an easier way to configure in production too. – warmjaijai Oct 19 '18 at 04:21
  • Maybe this article will help: https://phpraxis.wordpress.com/2016/08/02/steps-for-configuring-laravel-on-apache-http-server/ – John Hanley Oct 19 '18 at 04:27
  • John Hanley~ thank you for your helps all the way long. I have attempted as the site suggested but effort seems to still be in vain. – warmjaijai Oct 21 '18 at 06:09
  • Please have a look at my edit in the post and see what i am missing at your convenience~ thank you very much – warmjaijai Oct 22 '18 at 03:05