VPS侦探论坛

 找回密码
 注册
查看: 7115|回复: 9

安装bookstack后配置nginx,却只显示lnmp主页

[复制链接]
发表于 2021-8-25 14:40:31 | 显示全部楼层 |阅读模式

我之前已经用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的默认主页,不知道怎么回事
  1. server
  2.     {
  3.         listen 6123;
  4.         #listen [::]:80;
  5.         server_name book.wandersky.org;
  6.         index index.php;
  7.         root  /home/wwwroot/book.wandersky.org/BookStack/public;

  8.         client_max_body_size 1G;
  9.         fastcgi_buffers 64 4K;

  10.         include rewrite/other.conf;
  11.         #error_page   404   /404.html;
  12.         include enable-php-pathinfo.conf;

  13.         location / {
  14.             try_files $uri $uri/ /index.php?$query_string;
  15.         }
  16.         location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
  17.             deny all;
  18.         }
  19.         location ~ \.php(?:$|/) {
  20.             fastcgi_split_path_info ^(.+\.php)(/.+)$;
  21.             include fastcgi_params;
  22.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  23.             fastcgi_param PATH_INFO $fastcgi_path_info;
  24.             fastcgi_pass unix:/var/run/php-fpm.sock;
  25.         }
  26.         location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
  27.             expires 30d;
  28.             access_log off;
  29.         }


  30.         access_log  /home/wwwlogs/bookstack_access.log;
  31.         error_log  /home/wwwlogs/bookstack_error.log;
  32.     }
复制代码


美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2021-8-25 20:03:54 | 显示全部楼层


不会写直接写配置文件不要网上直接抄,直接 lnmp vhost add 添加,bookstack应该是不需要开启pathinfo的
伪静态的话是和laravel一样的,直接选laravel的伪静态就行
不清楚你改的什么http选项,是否有其他错误
这种目录设置public的一般还需要去掉防跨目录设置
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2021-8-26 02:22:27 | 显示全部楼层

licess 发表于 2021-8-25 20:03
不会写直接写配置文件不要网上直接抄,直接 lnmp vhost add 添加,bookstack应该是不需要开启pathinfo的
伪 ...

从新添加虚拟主机后只修改了配置文件的端口号还是没用。。。只能显示lnmp 主页
  1. server
  2.     {
  3.         listen 6123;
  4.         #listen [::]:80;
  5.         server_name book.wandersky.org ;
  6.         index index.php;
  7.         root  /home/wwwroot/book.wandersky.org/BookStack/public;

  8.         include rewrite/laravel.conf;
  9.         #error_page   404   /404.html;

  10.         # Deny access to PHP files in specific directory
  11.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  12.         include enable-php.conf;

  13.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  14.         {
  15.             expires      30d;
  16.         }

  17.         location ~ .*\.(js|css)?$
  18.         {
  19.             expires      12h;
  20.         }

  21.         location ~ /.well-known {
  22.             allow all;
  23.         }

  24.         access_log off;
  25.     }

  26. server
  27.     {
  28.         listen 443 ssl http2;
  29.         #listen [::]:443 ssl http2;
  30.         server_name book.wandersky.org ;
  31.         index index.html index.htm index.php default.html default.htm default.php;
  32.         root  /home/wwwroot/book.wandersky.org/BookStack/public;

  33.         ssl_certificate /usr/local/nginx/conf/ssl/book.wandersky.org/fullchain.cer;
  34.         ssl_certificate_key /usr/local/nginx/conf/ssl/book.wandersky.org/book.wandersky.org.key;
  35.         ssl_session_timeout 5m;
  36.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  37.         ssl_prefer_server_ciphers on;
  38.         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";
  39.         ssl_session_cache builtin:1000 shared:SSL:10m;
  40.         # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
  41.         ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

  42.         include rewrite/laravel.conf;
  43.         #error_page   404   /404.html;

  44.         # Deny access to PHP files in specific directory
  45.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  46.         include enable-php.conf;

  47.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  48.         {
  49.             expires      30d;
  50.         }

  51.         location ~ .*\.(js|css)?$
  52.         {
  53.             expires      12h;
  54.         }

  55.         location ~ /.well-known {
  56.             allow all;
  57.         }


  58.         access_log off;
  59.     }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2021-8-26 11:04:07 | 显示全部楼层



按你配置中的域名没有显示lnmp默认页面
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2021-8-26 13:05:36 | 显示全部楼层

本帖最后由 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!页面这是那个的配置
  1. user  www www;

  2. worker_processes auto;
  3. worker_cpu_affinity auto;

  4. error_log  /home/wwwlogs/nginx_error.log  crit;

  5. pid        /usr/local/nginx/logs/nginx.pid;

  6. #Specifies the value for maximum file descriptors that can be opened by this process.
  7. worker_rlimit_nofile 51200;

  8. events
  9.     {
  10.         use epoll;
  11.         worker_connections 51200;
  12.         multi_accept off;
  13.         accept_mutex off;
  14.     }

  15. http
  16.     {
  17.         include       mime.types;
  18.         default_type  application/octet-stream;

  19.         server_names_hash_bucket_size 128;
  20.         client_header_buffer_size 32k;
  21.         large_client_header_buffers 4 32k;
  22.         client_max_body_size 50m;

  23.         sendfile on;
  24.         sendfile_max_chunk 512k;
  25.         tcp_nopush on;

  26.         keepalive_timeout 60;

  27.         tcp_nodelay on;

  28.         fastcgi_connect_timeout 300;
  29.         fastcgi_send_timeout 300;
  30.         fastcgi_read_timeout 300;
  31.         fastcgi_buffer_size 64k;
  32.         fastcgi_buffers 4 64k;
  33.         fastcgi_busy_buffers_size 128k;
  34.         fastcgi_temp_file_write_size 256k;

  35.         gzip on;
  36.         gzip_min_length  1k;
  37.         gzip_buffers     4 16k;
  38.         gzip_http_version 1.1;
  39.         gzip_comp_level 2;
  40.         gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
  41.         gzip_vary on;
  42.         gzip_proxied   expired no-cache no-store private auth;
  43.         gzip_disable   "MSIE [1-6]\.";

  44.         #limit_conn_zone $binary_remote_addr zone=perip:10m;
  45.         ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.

  46.         server_tokens off;
  47.         access_log off;

  48. server
  49.     {
  50.         listen 80 default_server reuseport;
  51.         #listen [::]:80 default_server ipv6only=on;
  52.         server_name _;
  53.         #index index.html index.htm index.php;
  54.         #root  /home/wwwroot/default;

  55.         #error_page   404   /404.html;

  56.         # Deny access to PHP files in specific directory
  57.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  58.         include enable-php.conf;

  59.         location /nginx_status
  60.         {
  61.             stub_status on;
  62.             access_log   off;
  63.         }

  64.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  65.         {
  66.             expires      30d;
  67.         }

  68.         location ~ .*\.(js|css)?$
  69.         {
  70.             expires      12h;
  71.         }

  72.         location ~ /.well-known {
  73.             allow all;
  74.         }

  75.         location ~ /\.
  76.         {
  77.             deny all;
  78.         }

  79.         access_log  /home/wwwlogs/access.log;
  80.     }
  81. include vhost/*.conf;
  82. }
复制代码


军哥运维代购:http://shop63846532.taobao.com/

发表于 2021-8-26 14:49:45 | 显示全部楼层

dajf 发表于 2021-8-26 13:05
因为后来我把nginx.conf 里的index 和root注释掉了, 现在打开http:book.wandersky.org 注意不是https会 ...

可能你配置文件上有其他错误的,不要改动 nginx.conf
 楼主| 发表于 2021-8-26 20:06:56 | 显示全部楼层

licess 发表于 2021-8-26 14:49
可能你配置文件上有其他错误的,不要改动 nginx.conf

如果不把nginx.conf的那两行注释掉就会显示lnm页面了,但是为什么bookstack.conf配置没有起作用就不知道了
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2021-8-26 21:10:14 | 显示全部楼层

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/
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2021-8-26 23:43:31 | 显示全部楼层

dajf 发表于 2021-8-26 21:10
难道是我这步配错了#确保storage,bootstrap/cache&public/uploads文件夹可被Web服务器写入
我用的是chm ...

这是错误日志
2021/08/26 23:41:13 [error] 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"
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2021-8-27 00:16:01 | 显示全部楼层



licess 发表于 2021-8-25 20:03
不会写直接写配置文件不要网上直接抄,直接 lnmp vhost add 添加,bookstack应该是不需要开启pathinfo的
伪 ...

解决了,是防跨目录的问题,谢了军哥
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-20 20:25 , Processed in 0.028701 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表