我在使用nginx的Ubuntu 14.04上。 我的网站是用laravel构建的,它可以像你期望的那样工作:example.com,example.com / page等所有工作
我要做的是以下内容: example.com上的每个页面都应该由laravel提供服务,example.com / blog除外。 /博客应该由Ghost提供。
网站的位置是:
由于本教程的帮助,我设法在子域(ghost.example.com)上成功安装了Ghost:https://www.digitalocean.com/community/tutorials/how-to-create-a-blog-with-ghost-and-nginx-on-ubuntu-14-04
现在,当我访问example.com/blog时,它链接到example.com
这是我的nginx conf:
server {
listen 443;
ssl on;
ssl_certificate ...;
ssl_certificate_key ...;
server_name example.com;
include hhvm.conf;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
root /var/www/laravel/public;
index index.html index.htm index.php;
location / {
# URLs to attempt, including pretty ones.
try_files $uri $uri/ /index.php?$query_string;
}
location ^~ /blog {
# this works perfectly
# return 301 http://www.google.com;
# I got this code from the tutorial
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:2368;
proxy_redirect off;
}
# Remove trailing slash to please routing system.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
}
ghost配置文件:
production: {
url: 'https://example.com/blog',
mail: {},
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/content/data/ghost.db')
},
debug: false
},
server: {
host: '0.0.0.0',
port: '2368'
}
},