安装bookstack后配置nginx,却只显示lnmp主页
我之前已经用lnmp搭建了一个wordpress,放在默认的网址www.xyz.org下,然后又新建了一个虚拟主机,设置网址为book.xyx.org,然后配置了nginx,bookstack和wordpress的不同指出是要根目录指向BookStack/public文件夹,(https://www.bookstackapp.com/docs/admin/installation/),然后我修改了生成的配置文件的http项,由于不会暂时把https的配置删除了,结果打开book.xyx.com却显示lnmp的默认主页,不知道怎么回事server
{
listen 6123;
#listen [::]:80;
server_name book.wandersky.org;
index index.php;
root/home/wwwroot/book.wandersky.org/BookStack/public;
client_max_body_size 1G;
fastcgi_buffers 64 4K;
include rewrite/other.conf;
#error_page 404 /404.html;
include enable-php-pathinfo.conf;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
deny all;
}
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
access_log off;
}
access_log/home/wwwlogs/bookstack_access.log;
error_log/home/wwwlogs/bookstack_error.log;
}
不会写直接写配置文件不要网上直接抄,直接 lnmp vhost add 添加,bookstack应该是不需要开启pathinfo的
伪静态的话是和laravel一样的,直接选laravel的伪静态就行
不清楚你改的什么http选项,是否有其他错误
这种目录设置public的一般还需要去掉防跨目录设置 licess 发表于 2021-8-25 20:03
不会写直接写配置文件不要网上直接抄,直接 lnmp vhost add 添加,bookstack应该是不需要开启pathinfo的
伪 ...
从新添加虚拟主机后只修改了配置文件的端口号还是没用。。。只能显示lnmp 主页
server
{
listen 6123;
#listen [::]:80;
server_name book.wandersky.org ;
index index.php;
root/home/wwwroot/book.wandersky.org/BookStack/public;
include rewrite/laravel.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
access_log off;
}
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name book.wandersky.org ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/book.wandersky.org/BookStack/public;
ssl_certificate /usr/local/nginx/conf/ssl/book.wandersky.org/fullchain.cer;
ssl_certificate_key /usr/local/nginx/conf/ssl/book.wandersky.org/book.wandersky.org.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
include rewrite/laravel.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
access_log off;
}
按你配置中的域名没有显示lnmp默认页面 本帖最后由 dajf 于 2021-8-26 13:11 编辑
licess 发表于 2021-8-26 11:04
按你配置中的域名没有显示lnmp默认页面
因为后来我把nginx.conf (是和vhost相同目录里的那个)里的index 和root注释掉了, 现在打开http:book.wandersky.org 注意不是https会显示Welcome to nginx!页面这是那个的配置
userwww www;
worker_processes auto;
worker_cpu_affinity auto;
error_log/home/wwwlogs/nginx_error.logcrit;
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
multi_accept off;
accept_mutex off;
}
http
{
include mime.types;
default_typeapplication/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
sendfile_max_chunk 512k;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE \.";
#limit_conn_zone $binary_remote_addr zone=perip:10m;
##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.
server_tokens off;
access_log off;
server
{
listen 80 default_server reuseport;
#listen [::]:80 default_server ipv6only=on;
server_name _;
#index index.html index.htm index.php;
#root/home/wwwroot/default;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log/home/wwwlogs/access.log;
}
include vhost/*.conf;
}
dajf 发表于 2021-8-26 13:05
因为后来我把nginx.conf 里的index 和root注释掉了, 现在打开http:book.wandersky.org 注意不是https会 ...
可能你配置文件上有其他错误的,不要改动 nginx.conf licess 发表于 2021-8-26 14:49
可能你配置文件上有其他错误的,不要改动 nginx.conf
如果不把nginx.conf的那两行注释掉就会显示lnm页面了,但是为什么bookstack.conf配置没有起作用就不知道了 dajf 发表于 2021-8-26 20:06
如果不把nginx.conf的那两行注释掉就会显示lnm页面了,但是为什么bookstack.conf配置没有起作用就不知道 ...
难道是我这步配错了#确保storage,bootstrap/cache&public/uploads文件夹可被Web服务器写入
我用的是chmod -R 755 /home/wwwroot/book.wandersky.org && chown -R www /home/wwwroot/book.wandersky.org 我看有人用的是chown -R nginx:nginx /opt/www/BookStack/ dajf 发表于 2021-8-26 21:10
难道是我这步配错了#确保storage,bootstrap/cache&public/uploads文件夹可被Web服务器写入
我用的是chm ...
这是错误日志
2021/08/26 23:41:13 24130#0: *1 FastCGI sent in stderr: "PHP message: PHP Warning:require(): open_basedir restriction in effect. File(/home/wwwroot/book.wandersky.org/BookStack/vendor/autoload.php) is not within the allowed path(s): (/home/wwwroot/book.wandersky.org/BookStack/public/:/tmp/:/proc/) in /home/wwwroot/book.wandersky.org/BookStack/public/index.php on line 24PHP message: PHP Warning:require(/home/wwwroot/book.wandersky.org/BookStack/vendor/autoload.php): failed to open stream: Operation not permitted in /home/wwwroot/book.wandersky.org/BookStack/public/index.php on line 24PHP message: PHP Fatal error:require(): Failed opening required '/home/wwwroot/book.wandersky.org/BookStack/public/../vendor/autoload.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/book.wandersky.org/BookStack/public/index.php on line 24" while reading response header from upstream, client: 172.96.196.39, server: book.wandersky.org, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "book.wandersky.org" licess 发表于 2021-8-25 20:03
不会写直接写配置文件不要网上直接抄,直接 lnmp vhost add 添加,bookstack应该是不需要开启pathinfo的
伪 ...
解决了,是防跨目录的问题,谢了军哥
页:
[1]