Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

leighmedy's avatar

Laravel Project - Deploy using own Server

Hey guys! I'm new to web development. I was just wondering if you could help me with my situation. I don't even know the right keys to ask google on this.

I have successfully created my laravel project locally. I just want to transfer the project to our server so that it can be access through the internet. I am clueless how to do that. How can I deploy my laravel project to the internet using our server?

0 likes
3 replies
jeffdavis's avatar

A lot depends on the server. Have you set up a website on this server before? Do you have SSH access? Is it a shared server?

The bottom line is that you need to set up a website on the server. A folder on the server needs to be set up to be web accessible at some url, like http://myserver.com or a subdomain like http://subdomain.myserver.com.

Then you have to upload your files from the local project to the website folder on the server. This can be done various ways, via FTP, SSH, or a pull from a git repository somewhere.

So tell us a little more about your server and we can help. General info, no user names or passwords.

internet-crossroads's avatar

+1 on Forge. Definitely worth the money. That said, I have made myself a "to do list" for setting up nginx, ubuntu 16, mysql etc... I've used it successfully about 5 times but I still make slight adjustments from time to time. Enjoy!

LEMP Laravel 5.3 Install Notes

Install Ubuntu 16 (with a usb key on whatever hardware, this varies wildly but ive gotten a NUC and a giant SuperMicro working on the same usb key so...)

Hostname = <computer name>
Username = <user name>

(this is run on your remote computer to access the server from...i use a macbook, so i just open the terminal. i installed ssh-copy-id through homebrew i think, but if you're on windows...ssh is a pain)
ssh-copy-id <user name>@<ip>

(still not sure which order these three should go in lol)
sudo apt-get dist-upgrade
sudo apt-get upgrade
sudo apt-get update
sudo reboot

sudo apt install openssh-server openssh-client

sudo pico /etc/ssh/sshd_config
(change)        PasswordAuthentication no
(default)       PubkeyAuthentication yes
(default)       ChallengeResponseAuthentication no
(uncomment) AuthorizedKeysFile     %h/.ssh/authorized_keys

sudo systemctl reload sshd

ssh-keygen -t rsa -b 4096
sudo apt-get install nginx
sudo systemctl enable nginx
sudo apt install mysql-server mysql-client
sudo mysql_secure_installation
mysql -u root -p
    CREATE DATABASE <database name>;
    GRANT ALL ON <database name>.* TO '<new user>' IDENTIFIED BY '<new password>';
exit
sudo apt-get install php git unzip zip curl php-curl php-mcrypt php-mbstring php-gettext php-mysql
sudo phpenmod mcrypt
sudo phpenmod mbstring
sudo apt install redis-server redis-tools
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo pico /etc/php/7.0/fpm/pool.d/www.conf
    ;listen = /run/php/php7.0-fpm.sock
    listen = 127.0.0.1:9000
    user = <user name>
    group = <user name>

sudo pico /etc/nginx/sites-available/default
sudo systemctl restart nginx

INSTALL .ENV FILE INTO BASE PROJECT FOLDER

php artisan migrate
php artisan db:seed
php artisan storage:link

*********** NGINX DEFAULT SITES-AVAILABLE ***********

server {
    listen 80;
    server_name <IP>; # IP of location

    root /home/<project-name>/public;

    index index.php index.html index.htm;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/optimize-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}
1 like

Please or to participate in this conversation.