1

nginxを使用してUbuntu 14.04を使用しています。私のウェブサイトはlaravelで構築されており、期待どおりに機能します:example.com、example.com/pageなど、すべて機能します

私がやろうとしていることは次のとおりです。/blog は Ghost によって提供される必要があります。

Web サイトの場所は次のとおりです。

  • メインサイトの /var/www/laravel(/public)
  • ブログの /var/www/ghost

このチュートリアルの助けを借りて、サブドメイン (ghost.example.com) にゴーストを正常にインストールできました: 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;
    }
}

ゴースト設定ファイル:

 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'
        }
    },
4

0 に答える 0