2017-08-03 128 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; 
    } 
}