"Cannot get / " 幽灵博客托管问题
"Cannot get / " Ghost blog hosting issue
我想用我的 angular 应用程序安装一个幽灵博客。 Angular app 和 ghost 博客在文件系统中分别位于 "example_site" 和 "example_blog" 的不同目录中。我的 angular 应用程序在 "example.in" 上,我希望幽灵博客可以在 "example.in/blogs" 下访问。
我使用了代理,这是我的 apache 服务器配置
<virtualHost *:80>
ServerName example.in
ServerAlias www.example.in
ServerAdmin webmaster@localhost
RedirectMatch permanent ^(.*)$ https://www.example.in
</virtualHost>
<VirtualHost *:443>
ServerName example.in
ServerAlias www.example.in
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example_site/dist/
<Directory /var/www/html/example_site/dist/>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.html [L]
</Directory>
ProxyPreserveHost On
ProxyPass /blogs/ http://127.0.0.1:2368/
ProxyPassReverse /blogs/ http://127.0.0.1:2368/
SSLEngine on
SSLCertificateFile /var/www/html/example_site/cert/123.crt
SSLCertificateKeyFile /var/www/html/example_site/cert/example.key
SSLCertificateChainFile /var/www/html/example_site/cert/examplecrt
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
这是我的幽灵配置
{
"url": "https://example.in/blogs",
"server": {
"port": 2368,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "admin",
"password": "***",
"database": "example_blogs_prod"
}
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/www/html/example_blogs/content"
}
}
我得到了解决方案
我添加了 RequestHeader set X-Forwarded-Proto https
并对文件做了一些更改,这是更新后的文件
这是我的 apache 服务器配置
<virtualHost *:80>
ServerName example.in
ServerAlias www.example.in
ServerAdmin webmaster@localhost
RedirectMatch permanent ^(.*)$ https://www.example.in
</virtualHost>
<VirtualHost *:443>
ServerName example.in
ServerAlias www.example.in
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example_site/dist/
<Directory /var/www/html/example_site/dist/>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.html [L]
</Directory>
RequestHeader set X-Forwarded-Proto https
ProxyPreserveHost On
ProxyPass /blogs http://localhost:2368/blogs
ProxyPassReverse /blogs http://localhost:2368/blogs
SSLEngine on
SSLCertificateFile /var/www/html/example_site/cert/123.crt
SSLCertificateKeyFile /var/www/html/example_site/cert/example.key
SSLCertificateChainFile /var/www/html/example_site/cert/examplecrt
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
这是 ghost 配置文件
{
"url": "https://example.in/blogs",
"server": {
"port": 2368,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "admin",
"password": "***",
"database": "example_blogs_prod"
}
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/www/html/example_blogs/content"
}
}
我想用我的 angular 应用程序安装一个幽灵博客。 Angular app 和 ghost 博客在文件系统中分别位于 "example_site" 和 "example_blog" 的不同目录中。我的 angular 应用程序在 "example.in" 上,我希望幽灵博客可以在 "example.in/blogs" 下访问。 我使用了代理,这是我的 apache 服务器配置
<virtualHost *:80>
ServerName example.in
ServerAlias www.example.in
ServerAdmin webmaster@localhost
RedirectMatch permanent ^(.*)$ https://www.example.in
</virtualHost>
<VirtualHost *:443>
ServerName example.in
ServerAlias www.example.in
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example_site/dist/
<Directory /var/www/html/example_site/dist/>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.html [L]
</Directory>
ProxyPreserveHost On
ProxyPass /blogs/ http://127.0.0.1:2368/
ProxyPassReverse /blogs/ http://127.0.0.1:2368/
SSLEngine on
SSLCertificateFile /var/www/html/example_site/cert/123.crt
SSLCertificateKeyFile /var/www/html/example_site/cert/example.key
SSLCertificateChainFile /var/www/html/example_site/cert/examplecrt
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
这是我的幽灵配置
{
"url": "https://example.in/blogs",
"server": {
"port": 2368,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "admin",
"password": "***",
"database": "example_blogs_prod"
}
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/www/html/example_blogs/content"
}
}
我得到了解决方案 我添加了 RequestHeader set X-Forwarded-Proto https 并对文件做了一些更改,这是更新后的文件 这是我的 apache 服务器配置
<virtualHost *:80>
ServerName example.in
ServerAlias www.example.in
ServerAdmin webmaster@localhost
RedirectMatch permanent ^(.*)$ https://www.example.in
</virtualHost>
<VirtualHost *:443>
ServerName example.in
ServerAlias www.example.in
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/example_site/dist/
<Directory /var/www/html/example_site/dist/>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.html [L]
</Directory>
RequestHeader set X-Forwarded-Proto https
ProxyPreserveHost On
ProxyPass /blogs http://localhost:2368/blogs
ProxyPassReverse /blogs http://localhost:2368/blogs
SSLEngine on
SSLCertificateFile /var/www/html/example_site/cert/123.crt
SSLCertificateKeyFile /var/www/html/example_site/cert/example.key
SSLCertificateChainFile /var/www/html/example_site/cert/examplecrt
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
这是 ghost 配置文件
{
"url": "https://example.in/blogs",
"server": {
"port": 2368,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "admin",
"password": "***",
"database": "example_blogs_prod"
}
},
"mail": {
"transport": "Direct"
},
"logging": {
"transports": [
"file",
"stdout"
]
},
"process": "systemd",
"paths": {
"contentPath": "/var/www/html/example_blogs/content"
}
}