nginx 配置哪里出错了 ?

2020-01-25 10:01:31 +08:00
 station
整了台机子,搭建 NAS,其中 nextcloud 卡在 lnmp 的配置上

centos 8 全套 dnf 安装
输入 ip,页面就是 File not found.
参考了搜索结果,感觉没问题啊


#定义 Nginx 运行的用户和用户组
user nginx nginx;

#nginx 进程数,建议设置为等于 CPU 总核心数
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

# 进程 Pid 文件
#pid /var/run/nginx/nginx.pid;


events {
use epoll;
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;
root /var/www/nextcloud;
index index.html index.htm;
charset utf-8;

#access_log logs/host.access.log main;

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
4580 次点击
所在节点    NGINX
19 条回复
eason1874
2020-01-25 10:33:09 +08:00
这两行改成这样试试,记得重启 Nginx。

listen 80 default_server;
server_name _;
station
2020-01-25 10:37:01 +08:00
@eason1874 还是不行....
xiri
2020-01-25 10:39:59 +08:00
你没有把 index.php 加进 index 里,,,,,,

root
iamverylovely
2020-01-25 10:40:20 +08:00
路径后面加个斜杠看看。☺
xiri
2020-01-25 10:40:39 +08:00
@xiri index index.html index.htm 改成
index index.html index.htm index.php
Buges
2020-01-25 11:29:55 +08:00
没什么特殊要求的话,Web 服务器建议用 caddy,省时省力配置简单明了。
laowudxf
2020-01-25 12:43:41 +08:00
你监听的是 sock 文件 你的备注写的是监听 9000 端口,你 php-fpm 有没有设置对
black11black
2020-01-25 13:15:36 +08:00
你的 fpm 提交确实有问题,一般安装目录都是带版本号的,你这个应该是直接把代码贴过来的吧。另外不成功可以尝试把 Documentroot 写死。可以开 f12 看一下返回头里是否有 xphp 解析信息

另外问一下 nextcloud 是开原的 nas 系统吗?买群晖和自建方案比起来哪个合适?
w0nglend
2020-01-25 14:38:23 +08:00
nextcloud 可以直接用 docker 跑起来。不用折腾
daimaosix
2020-01-25 17:20:21 +08:00
配置一下伪静态
daimaosix
2020-01-25 17:21:57 +08:00
xfspace
2020-01-25 18:03:35 +08:00
文件夹 /结尾


fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


$document_root 直接引用 root 值

/var/www/nextcloudindex.php

/var/www/nextcloud/index.php
station
2020-01-25 18:48:35 +08:00
@black11black

fpm 的路径是默认配置 ls /var/run/php-fpm 结果: php-fpm.pid 和 www.sock

nextcloud 是开源的,但不是 nas 系统:一个私有网盘套件
station
2020-01-25 18:54:30 +08:00
@w0nglend 惭愧不会 docker

@laowudxf 不要在意注释,那个是没修改的

@xiri 试过,一样的结果
MrUser
2020-01-25 19:45:43 +08:00
检查下 php-fpm 的 sock 路径与你 nginx 里写的是不是一致
millionart
2020-01-25 20:24:25 +08:00
https://www.digitalocean.com/community/tools/nginx
用这个生成吧,或者照着一行行改
Yourshell
2020-01-25 20:32:55 +08:00
看日志啊
justrand
2020-01-26 12:09:25 +08:00
对啊,为什么不先看下错误日志呢?
neighbads
2020-01-26 16:52:49 +08:00
nextcloud 太大了。。。用了半年换成了 caddy

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/640235

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX