mercredi 27 novembre 2019

How to configure multiple laravel site/projects on a VPS?

I have the following two Laravel projects:

1.lsapp 2.larvel

I'm trying to achieve something like this: myIPaddress/lsapp and myPIaddress/laravel respectively. At the moment, I'm using my IP address.

I have the following /etc/nginx/sites-available/my-projects file:

server {
listen 80;
listen [::]:80;

root /var/www/lsapp/public;
index index.php index.html index.htm index.nginx-debian.html;

server_name myIPaddress;

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

location /laravel{
root /var/www/laravel/public;
rewrite ^/laravel/(.*)$ /var/www/laravel/public/index.php?$1 last;
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}

location ~ /\.ht {
deny all;
}

}

I have the following hosts file. Not sure if it matters:

127.0.0.1   localhost
127.0.1.1   guest

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

127.0.0.1 laravel_test
::1       laravel_test

By the way, I am using Ubuntu 16.04 with NGINX. I am using Vultr for my VPS.

I've been trying to look for answers on Google and among other websites, but I haven't found a solution. I did find that people suggest to install Laravel Homestead. Any help will be appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire