Degree .netcore 1.0 app to Ubuntu?



  • Can you tell me how to put the ubuntu annex on the sale?



  • In general, the reference is fully detailed (docs.asp.net/en/latest/publishing/linuxproduction.html). My steps were as follows (Ubuntu 16.04):

    1. Establish .net core if not determined;
    2. Load the application binary on prod server, make sure it starts. The server turns into Ubuntu, then Kestrel:
     var host = new WebHostBuilder()
                    .UseKestrel()
                    .UseConfiguration(config)
                    .UseContentRoot(Directory.GetCurrentDirectory())
                    .UseStartup<Startup.Startup>()
                    .Build();
    
    1. The article above recommends the use of nginx. Until asp.net is not very friendly with ssl and other things, and nginx can. That's why we put it. Normal routing can also be built: 1. Install: sudo apt-get install nginx 2. Start: sudo service nginx start 3. Check: sudo service nginx status
    2. In nginx.config (/etc/nginx/nginx.config), routing is built:

    location /test/gateway/ {

                        rewrite /test/gateway/(.*) /$1  break;
                        proxy_http_version 1.1;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection keep-alive;
                        proxy_set_header Host $host;
                        proxy_cache_bypass $http_upgrade;
                        proxy_pass http://127.0.0.1:9595;
                }
    

    In proxy_pass, you indicate the way to your annex. I'm still on the same car with a test app and production. So use different URLs for their access.

    rewrite /test/gateway/(.*) /$1  break;
    

    This team changes url by removing /test/gateway/. Thus, access to the test and combat server is only different in the outer url, there is no need to change within the annex.

    1. Let's make the app uploaded at the start and overloaded at the fall. Systemctl is used for this. In /etc/systemd/system, create a file app_name.service with the following contents:
    [Unit]
    Description=Gateway server for StreetFlow.
    

    [Service]
    TimeoutStartSec=0
    ExecStart=/usr/bin/dotnet /etc/bt/st.gateway/GatewayServer.dll

    WorkingDirectory=/etc/bt/st.gateway
    Restart=always

    [Install]
    WantedBy=multi-user.target

    We're pointing out what team we need to do if we have to make a mistake. It is also possible to indicate dependence, say postgresql or nginx.
    After the service has been established, two teams have to be performed:
    sudo systemctl enable your_app
    sudo systemctl start your_app
    Sometimes after a change in configuration, the service may not start. It's being treated by a team.
    sudo systemctl daemon-reload.

    Congratulations, your app is full!




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2