2017-08-03 122 views
0

我已經配置有光澤服務器確定,我不能重定向本地主機:3838shiny.mywebsite.com閃亮服務器和nginx的子域

我跟着這個Redirect subdomain to port [nginx/flask]和RStudio導遊,但沒有成功。

我試圖

server { 
    listen 80; 
    server_name shiny.mywebsite.com; 

    location/{ 
     proxy_pass http://localhost:3838; 
    } 
} 

server { 
    listen 80; 
    server_name shiny.mywebsite.com; 

    root /shiny; 

    access_log /var/log/nginx/shiny.access.log; 
    error_log /var/log/nginx/shiny.error.log; 

    location/{ 
     index index.html; 
     autoindex on; 
    } 
} 

被放在/etc/nginx/sites-enabled/shiny.conf,只是可以訪問本地主機:3838但沒有shiny.mywebsite.com

回答

1

你應該在nginx配置文件中聲明80端口並不是shiny-server.conf我一開始也很困惑。

我的光澤,爲server.conf

# Instruct Shiny Server to run applications as the user "shiny" 
run_as shiny; 

server { 

    listen 3838; 
    location/{ 

    site_dir /home/shiny/ShinyApps; 

    log_dir /home/shiny/logs; 
    directory_index on; 
    } 
} 

我中啓用的站點 - /默認服務器。

請注意,您的網站將在/var/www/shiny.mywebsite.com目錄下。然後,您可以通過shiny.mywebsite.com/shiny/YourApps訪問您的閃亮應用,因爲我們在下面設置了代理通行證。

server { 
    listen 80 default_server; 
    listen [::]:80 default_server; 

    root /var/www/shiny.mywebsite.com; 
    # Add index.php to the list if you are using PHP 
    index index.html; 

    server_name asemenov.com; 

    location /shiny/ { 
     proxy_pass http://127.0.0.1:3838/; 
    } 

    location/{ 
     try_files $uri $uri/ =404; 
    } 
}