无法在 digitalocean nginx 上 Depoly laravel
Can't Depoly laravel on digitalocean nginx
所以我按照this instruction一步一步将我的laravel项目部署到digitalocean中,但我没有创建一个新的laravel项目,而是从gitlab克隆了我自己的项目
最后我打开了我的网站,我得到了默认的 html 页面
Please log into your droplet via SSH to configure your LEMP installation.
这是我的 nginx 文件:
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/tooran/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name 162.243.39.12;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
不知道您的示例,但here您可以找到有关 LEMP 堆栈的精彩教程。确保将字符串 root /var/www/html;
更改为 root /var/www/your_project/public;
和
location / {
try_files $uri $uri/ =404;
}
至
location / {
try_files $uri $uri/ /index.php?$query_string;
}
在/etc/nginx/sites-available/default
文件中。
所以我联系了 digitalocean,他们告诉我编辑 /etc/nginx/sites-enabled/digitalocean
而不是 /etc/nginx/sites-available/default
p.s:确保您的 laravel 文件夹中也有 .env 文件
所以我按照this instruction一步一步将我的laravel项目部署到digitalocean中,但我没有创建一个新的laravel项目,而是从gitlab克隆了我自己的项目
最后我打开了我的网站,我得到了默认的 html 页面
Please log into your droplet via SSH to configure your LEMP installation.
这是我的 nginx 文件:
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/tooran/public;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name 162.243.39.12;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
不知道您的示例,但here您可以找到有关 LEMP 堆栈的精彩教程。确保将字符串 root /var/www/html;
更改为 root /var/www/your_project/public;
和
location / {
try_files $uri $uri/ =404;
}
至
location / {
try_files $uri $uri/ /index.php?$query_string;
}
在/etc/nginx/sites-available/default
文件中。
所以我联系了 digitalocean,他们告诉我编辑 /etc/nginx/sites-enabled/digitalocean
而不是 /etc/nginx/sites-available/default
p.s:确保您的 laravel 文件夹中也有 .env 文件