之前在 VPS 主机上用 LNMP 一键安装包搭建了环境,然后安装了 wordpress,现在想在添加一个 bookstack,主页放在 wordpress 的二级目录 book.admin.com ,但是我在网上看了好多教程也没明白怎么配置 nginx 和 php-pfm,求教有谁懂吗?
1
skyroam OP 这是我的 nginx 配置,但是打开之后显示 502 Bad Gateway 错误,我也不知道是否还需要配置 php-pfm 和 bookstack
```nginx server { listen 80; #listen [::]:80; server_name book.xxxxxx.xxx ; index index.php index.html index.htm default.php default.htm default.html; root /home/www/BookStack/public; #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-pathinfo.conf; location / { proxy_pass http://localhost:9000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE_HOST $remote_addr; try_files $uri $uri/ /index.php?$query_string; } location ~ .*\.(php|css|rss|jsp|cgi|asp|aspx|flv|xml|gif|jpg|jpeg|png|bmp|swf)$ { proxy_pass http://localhost:9000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE_HOST $remote_addr; } } server { listen 443 ssl http2; #listen [::]:443 ssl http2; server_name book.xxxxxx.xxxx ; index index.php index.html index.htm default.php default.htm default.html; root /home/www/BookStack/public; # Deny access to PHP files in specific directory #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } include enable-php-pathinfo.conf; location / { proxy_pass http://localhost:9000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE_HOST $remote_addr; try_files $uri $uri/ /index.php?$query_string; } location ~ .*\.(php|css|rss|jsp|cgi|asp|aspx|flv|xml|gif|jpg|jpeg|png|bmp|swf)$ { proxy_pass http://localhost:9000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE_HOST $remote_addr; } location ~ /.well-known { allow all; } location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) { deny all; } access_log /home/www/logs/bookstack_access.log; error_log /home/www/logs/bookstack_error.log; } ``` |