首页 > 解决方案 > nginx:配置文件 /etc/nginx/nginx.conf 在 Laravel 项目中测试失败

问题描述

我使用 Ubuntu 将 Laravel-5.8 项目上传到 DigitalOcean 服务器。该网站运行良好。后来我决定创建虚拟主机,以便能够在同一台服务器上托管多个应用程序。

我点击了这个链接:

https://graspingtech.com/nginx-virtual-hosts-ubuntu-16-04/

现在我做了:

root@MyServer: cp /etc/nginx/sites-available/default /etc/nginx/sites-available/site1.conf
root@MyServer: cp /etc/nginx/sites-available/default /etc/nginx/sites-available/site2.conf

然后

root@MyServer: ln -s /etc/nginx/sites-available/site1.conf  /etc/nginx/sites-enabled/
root@MyServer: ln -s /etc/nginx/sites-available/site2.conf  /etc/nginx/sites-enabled/

然后当我这样做时:

root@MyServer: nginx -t

我收到了这个错误:

nginx:配置文件 /etc/nginx/nginx.conf 测试失败

这是/etc/nginx/nginx.conf的内容

ser www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;

# set client body size to 5M #
client_max_body_size 24000M;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

我该如何解决这个问题?

谢谢

标签: laravelnginxubuntu-18.04

解决方案


推荐阅读