【发布时间】:2020-02-15 03:18:58
【问题描述】:
我的应用程序在 ubuntu/nginx 上运行。我想使用 nginx 在 /blog url 上安装 wordpress。 请告诉我最好的方法。
【问题讨论】:
标签: python django wordpress nginx
我的应用程序在 ubuntu/nginx 上运行。我想使用 nginx 在 /blog url 上安装 wordpress。 请告诉我最好的方法。
【问题讨论】:
标签: python django wordpress nginx
你可以在 nginx 后面运行 apache。以下步骤对我有用。
1 在 /var/www/html/blog 使用 apache 服务器在端口 8080 处安装 wordpress。转到 /etc/apache2/sites-available/000-default.conf 并像下面这样编辑配置。
<VirtualHost *:8080>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName example.com
ServerAlias www.example.com
<IfModule mod_setenvif.c>
SetEnvIf X-Forwarded-Proto "^https$" HTTPS
</IfModule>
<Directory /var/www/html/blog>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/your_domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your_domain.com_access.log combined
</VirtualHost>
2 转到 /etc/apache2/ports.conf 并编辑如下配置并重新启动 apache 服务器。
Listen 8080
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
3 将以下代码添加到您的 nginx 设置中。
location /blog/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080 ;
}
【讨论】: