简体   繁体   English

闪亮的服务器和Nginx子域

[英]Shiny server and nginx subdomain

I have configured shiny server ok and I cannot redirect localhost:3838 to shiny.mywebsite.com 我已经配置了闪亮的服务器,并且无法将localhost:3838重定向到Shiny.mywebsite.com

I followed this Redirect subdomain to port [nginx/flask] and RStudio guides but no success. 我遵循了这个重定向子域,将其移植到端口[nginx / flask]和RStudio指南,但没有成功。

I tried 我试过了

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

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

and

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;
    }
}

to be put in /etc/nginx/sites-enabled/shiny.conf and just can access localhost:3838 but no shiny.mywebsite.com 放在/etc/nginx/sites-enabled/shiny.conf并且只能访问localhost:3838,但没有Shiny.mywebsite.com

You should declare port 80 in nginx configuration file and not the shiny-server.conf I was confused at the start too. 您应该在nginx配置文件中声明端口80,而不是在开始时也感到困惑的shiny-server.conf

My shiny-server.conf 我的shiny-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;
  }
}

My server within sites-enabled/default . 我的服务器在sites-enabled / default中

Note that your website will be under /var/www/shiny.mywebsite.com directory. 请注意,您的网站将位于/var/www/shiny.mywebsite.com目录下。 Then your shiny apps will be accessible via shiny.mywebsite.com/shiny/YourApps as we set up a proxy pass below. 然后,当我们在下面设置代理通行证时,将可以通过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;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM