- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
所以我使用 laravel 创建了一个应用程序,现在我尝试将其托管在 Debian 服务器中。
我上传了laravel在(/var/www/html/site)中找到的所有项目
(site) is the folder that contains all the files app, public, .env ....
只是还有一个 mybb 论坛正在运行(/var/www/html/board),这是另一个开发人员放置的,所以我不想做任何可能导致论坛瘫痪的错误操作
因此,在了解如何在 Debian 上启动 Laravel 项目之前,我按照说明 from this tutorial 进行操作。 ,(并非全部,因为我已经安装了 PHP 7.3、phpmyadmin)
This is how i set ( sudo vim /etc/nginx/sites-available/mydomain.com )
server {
server_name mydomain.com mydomain.com;
listen 80;
root /var/www/html/site/public;
access_log /var/log/nginx/laravel-access.log;
error_log /var/log/nginx/laravel-error.log;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
最后我运行这个社区
sudo service nginx restart
我收到此错误
root@ns300976:~# sudo service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
so next i try (systemctl status nginx.service) and i get this
root@ns300976:~# sudo service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
root@ns300976:~# systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-11-13 06:37:35 UTC; 40s ago
Docs: man:nginx(8)
Process: 21913 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/F
Process: 21911 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, s
nov. 13 06:37:33 ns300976 nginx[21913]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98:
nov. 13 06:37:34 ns300976 nginx[21913]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (9
nov. 13 06:37:34 ns300976 nginx[21913]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98:
nov. 13 06:37:34 ns300976 nginx[21913]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (9
nov. 13 06:37:34 ns300976 nginx[21913]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98:
nov. 13 06:37:35 ns300976 nginx[21913]: nginx: [emerg] still could not bind()
nov. 13 06:37:35 ns300976 systemd[1]: nginx.service: Control process exited, code=exited status=1
nov. 13 06:37:35 ns300976 systemd[1]: Failed to start A high performance web server and a reverse pr
nov. 13 06:37:35 ns300976 systemd[1]: nginx.service: Unit entered failed state.
nov. 13 06:37:35 ns300976 systemd[1]: nginx.service: Failed with result 'exit-code'.
lines 1-17/17 (END)
next i try (journalctl -xe) and i get this
root@ns300976:~# journalctl -xe
nov. 13 06:59:12 ns300976 sshd[22318]: Failed password for root from 112.85.42.89 port 41078 ssh2
nov. 13 06:59:14 ns300976 sshd[22318]: Failed password for root from 112.85.42.89 port 41078 ssh2
nov. 13 06:59:15 ns300976 sshd[22318]: Received disconnect from 112.85.42.89 port 41078:11: [preaut
nov. 13 06:59:15 ns300`enter code here`976 sshd[22318]: Disconnected from 112.85.42.89 port 41078 [preauth]
nov. 13 06:59:15 ns300976 sshd[22318]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty
nov. 13 07:01:01 ns300976 sudo[22331]: root : TTY=pts/1 ; PWD=/root ; USER=root ; COMMAND=/usr/s
nov. 13 07:01:01 ns300976 sudo[22331]: pam_unix(sudo:session): session opened for user root by root(
nov. 13 07:01:01 ns300976 systemd[1]: Starting A high performance web server and a reverse proxy ser
-- Subject: L'unité (unit) nginx.service a commencé à démarrer
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) nginx.service a commencé à démarrer.
nov. 13 07:01:01 ns300976 nginx[22340]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (9
nov. 13 07:01:01 ns300976 nginx[22340]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98:
nov. 13 07:01:02 ns300976 nginx[22340]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (9
nov. 13 07:01:02 ns300976 nginx[22340]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98:
nov. 13 07:01:02 ns300976 nginx[22340]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (9
nov. 13 07:01:02 ns300976 nginx[22340]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98:
nov. 13 07:01:03 ns300976 nginx[22340]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (9
nov. 13 07:01:03 ns300976 nginx[22340]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98:
nov. 13 07:01:03 ns300976 nginx[22340]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (9
nov. 13 07:01:03 ns300976 nginx[22340]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98:
nov. 13 07:01:04 ns300976 nginx[22340]: nginx: [emerg] still could not bind()
nov. 13 07:01:04 ns300976 sudo[22331]: pam_unix(sudo:session): session closed for user root
nov. 13 07:01:04 ns300976 systemd[1]: nginx.service: Control process exited, code=exited status=1
nov. 13 07:01:04 ns300976 systemd[1]: Failed to start A high performance web server and a reverse pr
-- Subject: L'unité (unit) nginx.service a échoué
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- L'unité (unit) nginx.service a échoué, avec le résultat failed.
nov. 13 07:01:04 ns300976 systemd[1]: nginx.service: Unit entered failed state.
nov. 13 07:01:04 ns300976 systemd[1]: nginx.service: Failed with result 'exit-code'.
这是我第一次使用 Linux 并寻找解决方案,我怀疑 apache2 阻塞了端口 80
但是通过杀掉进程,我担心会影响论坛,因为我不知道它是否使用 Apache2 的功能
如果我必须通过 Apache 运行我的应用程序,我想听听您的建议
感谢您的帮助!
最佳答案
在 root/var/www/html/site/public 之后;添加这个
index index.php index.html index.htm index.nginx-debian.html;
我认为你的 apache 正在运行。在正在运行的端口中检查这一点
sudo netstat -ntpl
然后终止该进程
sudo kill pid(your pid)
关于linux - 使用 Nginx 在 Debian 服务器上部署 Laravel 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58832147/
我是一名优秀的程序员,十分优秀!