user1137313 user1137313 - 8 days ago 5x
Apache Configuration Question

Configure remote Laravel app to be accessible from browser

I am a beginner with centos / laravel configuration so please bare with me. All the laravel projects I worked on were installed/configured started by other people. A long time ago I managed to install a Laravel project on a Windows machine using WAMP and it was easier as far as I remember.
I recently received access to a clean droplet from with Centos 7 installed. I think a droplet is something like a VPS. You have an IP, and SSH access
After some headacke I managed to successfully install laravel using composer. I have also installed mysql and apache(httpd)
Now I have


folder, with the installation of the latest Laravel (5.3)

I went inside /var/www/ and called

composer create-project laravel/laravel mypro

Now, I have a laravel app scheleton of a new application at


I would like to access it from a browser so I can start working on it, but I do not know what I need to do. There are many tutorials on how to do that but they are very confusing for me.

What must I do next in order to be able to see the results of what I am working on?
If , in the browser, I access now the droplet by IP, like

I get

Not Found The requested URL / was not found on this server.

Same if I add to the URL the name of my app like

I believe I must configure the httpd ? Or maybe move the project's folder somewhere else?

I tried moving my project folder inside /var/www/html folder, so


and now when I try to access the url I receive an empty page (view-source of the browser page returns also an empty page)
I even tried

since there is a server.php file in the root of my project folder... same result

I even added a conf to the /etc/httpd/conf.d/ folder called mypro.conf where I added these lines:

<VirtualHost *:80>
ServerName mypro
DocumentRoot "/var/www/html/mypro/public"
<Directory /var/www/html/mypro/public>
AllowOverride all

Nothing new happens
I did "service httpd restart" everytime a changed something.

I even tried

php artisan serve --host --port 8000

and tried the url

Now I get "Unable to connect" page from the browser so I stopped the "serve"

What is it that I have to do in order to be able to finally start working...?

Thank you


Following is way how i do it on Ubutnu 16.04 (It can be done with some changes on Centos).

Update your package repo.

sudo apt update

Update packeges.

sudo apt dist-upgrade

Install PHP

apt install php

Install apache2

apt install apache2

Install PHP Plugins

apt install php-mbstring php-pdo php-tokenizer php-xml php-mcrypt php-gd libapache2-mod-php php-curl php-mysql

Enable mcrypt

phpenmod mcrypt

a2enmod rewrite

Restart Apache Server

service apache2 restart

Install Composer

curl -sS | php

mv composer.phar /usr/local/bin/composer

Install Git

apt install git

Install mysql-server

apt install mysql-server

Install Phpmyadmin (Optional)

apt install phpmyadmin

Install zip & unzip

apt install zip unzip

Now create apache virtual host configuration for your website.

cd /etc/apache2/sites-available


The basic content of is

#content of
<VirtualHost *:80>

    DocumentRoot /var/www/html/

    <Directory /var/www/html/>
        AllowOverride All

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

Now goto /var/www/html

cd /var/www/html/

Create a directory with your website name


Now add a user because it is not good idea to work with composer as root while creating laravel project.

adduser admin --ingroup admin

Now make admin as owner of this directory

chown -R admin

Now login as admin

go to /var/www/html

cd /var/www/html

Install Laravel using composer

composer create-project laravel/laravel

cd /var/www/html/

Now your storage and bootstrap directory should have write permission for apache 2 server so make apache owner of these two directories.

chown -R www-data storage

chown -R www-data bootstrap

Now login as root


a2dissite 000-default.conf

service apache2 reload


service apache2 reload

service apache2 restart

It may not be the best way to work with any larave project , So feel free to comment or suggest an edit.