{"id":19782435,"url":"https://github.com/steadylearner/rust-web-app","last_synced_at":"2025-06-21T07:04:29.108Z","repository":{"id":38785292,"uuid":"163106348","full_name":"steadylearner/Rust-Web-App","owner":"steadylearner","description":"How to deploy Rust web application.","archived":false,"fork":false,"pushed_at":"2020-04-20T02:24:16.000Z","size":2484,"stargazers_count":31,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T05:32:28.484Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.steadylearner.com/about","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steadylearner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-25T19:18:41.000Z","updated_at":"2025-03-14T15:56:30.000Z","dependencies_parsed_at":"2022-09-18T03:32:01.867Z","dependency_job_id":null,"html_url":"https://github.com/steadylearner/Rust-Web-App","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steadylearner%2FRust-Web-App","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steadylearner%2FRust-Web-App/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steadylearner%2FRust-Web-App/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steadylearner%2FRust-Web-App/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steadylearner","download_url":"https://codeload.github.com/steadylearner/Rust-Web-App/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251791489,"owners_count":21644402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T06:05:08.839Z","updated_at":"2025-04-30T22:30:52.962Z","avatar_url":"https://github.com/steadylearner.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n  Post{\n    subtitle: \"Learn how to deploy Rust with Nginx and systemd service.\",\n    image: \"post/deploy/nginx-rust.png\",\n    image_decription: \"Image by Steadylearner\",\n    tags: \"How deploy Rust code\",\n  }\n--\u003e\n\n\u003c!-- Link --\u003e\n\n[Rust]: https://www.rust-lang.org/\n[Steadylearner]: https://www.steadylearner.com\n\n[EssentialC]: http://cslibrary.stanford.edu/101/EssentialC.pdf\n[The C Programming Lanugage]: https://www.google.com/search?q=the+c+programming+language\n[DigitalOcean]: http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM\n[Nginx]: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04-quickstart\n[Rust Web App]: https://github.com/steadylearner/Rust-Web-App\n[Rocket]: https://rocket.rs/v0.4/guide/configuration/\n\n\u003c!-- / --\u003e\n\n\u003c!-- Steadylearner Post --\u003e\n\n[How to install Rust]: https://www.steadylearner.com/blog/read/How-to-install-Rust\n[How to use Rust Yew]: https://www.steadylearner.com/blog/read/How-to-use-Rust-Yew\n[How to use Vim]: https://medium.com/@steadylearner/how-to-learn-vim-for-beginners-c81da6f5fde8\n\n\n\u003c!-- / --\u003e\n\nRust users mostly end up loving its features such as performance, reliability and productivity. It is not easy to start to learn it, but there are friendly communities to help you.\n\nOn top of that, there are decent package management tools like cargo, cargo-edit etc. The programming language itself and packages(crates in Rust) are maturing also.\n\nThe language developers and contributers are also giving their time to enhance [Webassembly][How to use Rust Yew] integration to attract more Frontend Developers and make web application faster.\n\nHowever, it was difficult to find the real examples for intergating frontend app to Rust and then deploying it to the web.\n\nI was not sure that I could upload my website to the web with Rust. But I eventually made it and want to share the process with you.\n\nIf you have already experience in deploying websites in other languases, deploying Rust will not be so different from deploying Node js or Python backend app.\n\n1. Buy VPS service such as [DigitalOcean] that offers the same operating system you use in your local machine.\n\n2. Repeat what you have been doing in your local development environment in a vritual machine they give.\n\n3. Configure Apache or Nginx and systemd service worker to start your project inside the host service.\n\nYou may read on or just modify your previous project for a Rust web framework you use.\n\n\u003cbr /\u003e\n\n\u003ch2 class=\"red-white\"\u003e[Prerequisite]\u003c/h2\u003e\n\n1. [How to install Rust]\n2. [Rust Website][Rust]\n3. [DigitalOcean]\n4. [SSH](https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/create-with-openssh/)\n5. [How to use Vim]\n6. [Deploy Rocket with Nginx and LetsEncrypt](https://gist.github.com/belst/ff36c5f3883f7bf9b06c379d0a7bed9e)\n7. [Bash Command](https://www.howtogeek.com/howto/ubuntu/keyboard-shortcuts-for-bash-command-shell-for-ubuntu-debian-suse-redhat-linux-etc/)\n8. [Linux](http://www.usm.uni-muenchen.de/people/puls/lessons/intro_general/Linux/Linux_for_beginners.pdf)\n\n---\n\nI hope you already have Rust installed in your machine and have web application ready.\n\nFor this post, I will use [DigitalOcean] as an example. First, I doubted that it would work or not with **Rust**. But later I found that it is easy if you already know how to use Linux Command Line. Because what they give you is just a Linux Virtual Machine and you can repeat what you did in your local machine.\n\nThen, it will work. You are watching if you are at [Steadylearner].\n\nIt works well with very low price with two month free trial time for you to test. You will not need that much time to begin with if you follow the instruction from this post.\n\nIt will be helpful if you are already familiar with **Vim**, **CLI**, **Linux** etc.\n\nYou should search for information about [Nginx]. It works well with default configuration but I hope you search information about it on your own.\n\nIf you don't have ssh keys in your machine yet, please follow the documentation from [DigitalOcean](https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/create-with-openssh/) I gave you.\n\nWhat you need to do is just type **ssh-keygen** and follow the instruction of machine.\n\nYou can repeat the process if your hardware is broken or when you need to start from nothing when you want to use it in antoher machine.\n\nIt will work in those situations also so do not worry and just follow the instructiosn your service providers give you.\n\nI hope you already know what is tld([top-level-domain](https://searchmicroservices.techtarget.com/definition/top-level-domain-TLD)).\n\n\u003cbr /\u003e\n\n\u003ch2 class=\"blue\"\u003eTable of Contents\u003c/h2\u003e\n\n1. DigitalOcean Setup\n2. Install dependencies for your virtual machine\n3. Configure Nginx as a reverse proxy server\n4. Save your project in your virtual machine and serve it\n5. Create systemd service for your web application\n6. HTTPS for your website\n7. Conclusion\n\n---\n\nYou can skip the **DigtialOcean Setup part** if you do not want to use it or just refer to it.\n\nYou will not need the **Installing Dependencies for Linux Virtual Machine** if you already know how to set up development environment.\n\nJust repeat what you have done in your local machine after you buy VPS service from [DigtialOcean] or whatever service host provide.\n\nIf you have problem while folllowing this post, please contact me with [Twitter](https://twitter.com/steadylearner_p) or LinkedIn(https://www.linkedin.com/in/steady-learner-3151b7164/) and I will help you.\n\n\u003cbr /\u003e\n\n## 1. DigitalOcean Setup\n\n\u003c!-- Use other image instead --\u003e\n[![DigitalOcean Website Screentshot by steadylearner](https://www.steadylearner.com/static/images/post/deploy/DigitalOcean-Main.png)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\nI wouldn’t write details about using **DigitalOcean** for there are many [documentations](https://www.digitalocean.com/docs/droplets/how-to/create/) for beginners already.\n\nJust use Ubuntu 16.04 or Ubuntu 18.04 or whatever you want and the lowest price version to follow this article.\n\nYou can use this as an example and hope you already made one.\n\n\u003cbr /\u003e\n\n[![DigitalOcean Website Screentshot by steadylearner](https://www.steadylearner.com/static/images/post/deploy/DigitalOcean-Create-Droplet.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\nYou can use whatever option you want but saving your resource is important.\n\nUse the lowest price option. It will be enough to test your project.\n\n\u003cbr /\u003e\n\n[![DigitalOcean Website Screentshot by steadylearner](https://www.steadylearner.com/static/images/post/deploy/DigitlaOcean-Lowest-Price.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\nand we will also use Ubuntu 16.04 for our choice.\n\n\u003cbr /\u003e\n\n[![DigitalOcean Website Screentshot by steadylearner](https://www.steadylearner.com/static/images/post/deploy/DigitalOcean-Ubuntu-16.04.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\nYour computer should have been connected with your virtual machine that the service provides with SSH like the image below following the instruction.\n\nWith command **$ssh yoursite@xxx.xxx.x.xx**, it will show you messages like the image below.\n\n\u003cbr /\u003e\n\n[![DigitalOcean Website Screentshot by steadylearner](https://www.steadylearner.com/static/images/post/deploy/SSH-Connection-sucess-for-Linux-Ubuntu-16.04.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\nYou will see **username@project:~$** in your Linux Kernel.\n\nWe are ready with DigitalOcean and we can write code to deploy our Rust Web Application with Nginx.\n\nYour Linux Virtual Machine is almost empty. It will be easy to think that you have to start from nothing.\n\nIt has Git to download your project easily, Vim to edit Nginx and Rust files already. We will see how to use them later.\n\nIf you forget the domain of your website, you can use\n\n```console\n$host www.steadylearner.com\n```\n\nTest it with **$host yourwebsite** instead.\n\n\u003cbr /\u003e\n\n## 2. Install dependencies for your virtual machine\n\nThis is very tedious work if you had many dependencies.\n\nFor your machine is just empty virtual machine, You have to install **Rust Compiler, Cargo, Node, Nginx** etc to prepare the deployment.\n\nIf you are familiar with **Docker**, you could have used it instead to save your time.\n\nWhat is important is to install Rust to compile your [Rust Web App] and [Nginx] to work as reverse proxy server for it.\n\nTo advance, You have to verify minimum requirments are ready with command\n\n**$sudo nginx -h**\n\n\u003cbr /\u003e\n\n[![nginx with nginx -h command](https://www.steadylearner.com/static/images/post/deploy/Nginx.png)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\n**$rustup**\n\n\u003cbr /\u003e\n\n[![rustup after installation](https://www.steadylearner.com/static/images/post/deploy/Rustup.png)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\n**$cargo**\n\n\u003cbr /\u003e\n\n[![cargo command after installation](https://www.steadylearner.com/static/images/post/deploy/Cargo.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\nand you are ready to write the real codes to deploy your website.\n\nIn this post, we will use **Rust Rocket framework** AS EXAMPLES but you can use Actix or whatever framework and languages instead.\n\nBecause what you learn really is how to use **Nginx** as **proxy server** for your web app in **POSIX** system.\n\n\u003cbr /\u003e\n\n## 3. Configure Nginx as a reverse proxy server\n\n\u003csection class=\"flex center\"\u003e\n  \u003cimg alt=\"Nginx from its website\" src=\"https://www.steadylearner.com/static/images/post/deploy/nginx.png\"\u003e\n\u003c/section\u003e\n\nYou are almost there. You could make it work with the documenations I gave you above.\n\nBut following the post will save your time, so I hope you did not tweak anything from the default yet.\n\nYou will se that is just the matter of **copy and paste** when you have [a real example][Steadylearner].\n\nRefer to the code snippet below for Nginx save it in /etc/nginx/sites-available/ as your-domain.tld.conf\n\n**your-domain.tld** could be **steadylearner.com**\n\nJust use yours instead.\n\n```nginx\nserver {\n    #listen 80; # Only if sysctl net.ipv6.bindv6only = 1\n    listen 80;\n    listen [::]:80;\n\n    server_name yourdomain.tld www.yourdomain.tld; # 1.\n\n    location / {\n        # Forward requests to rocket v4.0 production port\n        proxy_pass http://0.0.0.0:8000; # 2.\n        proxy_buffering off; # Single Page App work faster with it\n        proxy_set_header X-Real-IP $remote_addr;\n    }\n}\n```\n\nThe example is very simple but there are two points you should know.\n\n**1.** You need to enable **www** at [DigitalOcean] to prefix it to your sitename.\n\nYou may read [how-to-manage-records](https://www.digitalocean.com/docs/networking/dns/how-to/manage-records/), [using-cname-for-www](https://www.digitalocean.com/community/questions/using-cname-for-www-redirection).\n\nYou can refer to the image below.\n\n\u003cbr /\u003e\n\n[![Visit DigitalOcean to prefix www with http or https to redirect your domain](https://www.steadylearner.com/static/images/post/deploy/DigtialOcean-www-Cname.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\n**CNAME** is used for simpilicity, you can use **A** or **AAAA** record for www instead if you want to enable **HTTPS** later in this post.\n\n**2.** The Rust Web framework we will use is [Rocket] and the port for its production is http://0.0.0.0:8000. You had to help nginx to proxy the request to your Rust web application.\n\nYou could use other port and configuration if you use another framework such as Actix or ones from other languages etc.\n\nWhenever you edit nginx relevant files, you can test it with\n**$sudo nginx -t** and it will show messages similar to this.\n\n```console\nnginx: the configuration file /etc/nginx/nginx.conf syntax is ok\nnginx: configuration file /etc/nginx/nginx.conf test is successful\n```\n\nIf it passed, you can use make sym link for the file **your-domain.tld.conf** you made before with\n\n```console\ncd /etc/nginx/sites-enabled \u0026\u0026 sudo ln -s ../sites-available/your-domain.tld.conf\n```\n\nI hope you made it well to this point.\n\nYou will need various commands of **nginx** after you deploy your website.\n\nCopy and paste them inside your **~/.bashrc** file with **$vim ~/.bashrc** and use $source ~/.bashrc to use them if you want.\n\n**You don’t have to remember details if you know what you want to do.**\n\n```bash\n#nginx\nalias startn=\"sudo systemctl start nginx\"\nalias stopn=\"sudo systemctl stop nginx\"\nalias restartn=\"sudo systemctl restart nginx\"\nalias reloadn=\"sudo systemctl reload nginx\"\nalias statusn=\"service nginx status\"\nalias testn=\"sudo nginx -t\"\nalias foldern=\"cd /etc/nginx\"\n```\n\nThere were no diffiuclt points for Nginx. You didn’t even have to edit default **nginx.conf** file.\n\nIf you like to serve **gzip** file for your Rust Rocket or other web application.\n\nYou may include code snippet below and test them.\n\n```nginx\n#inside nginx.conf(/etc/nginx/nginx.conf)\n\n##\n# Gzip Settings\n##\n\ngzip on;\ngzip_disable \"msie6\";\n\ngzip_vary on;\ngzip_proxied any;\ngzip_comp_level 5; # it is better not to be larger than 5\ngzip_buffers 16 8k;\ngzip_http_version 1.1;\n\n# write what you want to be served as gzip compressed file when use requested it.\n\ngzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;\n```\n\nYou can verify it work with\n\n```console\n$curl http://yourdomain.com --silent --write-out \"%{size_download}\\n\" --output /dev/null\n\n$curl http://yourdomain.com --silent -H \"Accept-Encoding: gzip, other things\" --write-out \"%{size_download}\\n\" --output /dev/null\n```\n\nand the result will be much better and easier than do it without Nginx.\n\nIf you managed to serve gzip files on your own, you can use\n\n```console\n$find . | gzip *.ext\n$find . | gzip -d *.gz\n```\n\nto compress and decompress files in a target folder.\n\nYou do not need webpack compressor or else to do that.\n\n\u003cbr /\u003e\n\n## 4. Save your project in your virtual machine and serve it\n\nYour virtual machine was almost empty but you could edit and save the files with **Vim**.\n\nYou could also use **git** to download files for they are already pre-installed.\n\nYou may donwload your project files from you GitHub repository with command like\n\n```console\n$git clone https://github.com/steadylearner/Rust-Web-App.git.\n```\n\nYou can use whatever you want to save files in your virtual machine instead.\n\nYou might want to do it on your home directory. For that, use $cd ~ \u0026\u0026 mkdir yourwebsite and save your project files there.\n\nYou know better what you are doing than others. It is just repeating what you have done to build the entire project. The only difference is paths to serve and link files and directories.\n\nIf you are using Rust [Rocket] for this example,\n\n1. Download the files in your virtual machine\n\n2. Use **$cargo check** first to verify everything works fine first.\n\n3. **$cargo run --release** to make production files in target directory inside your virtual machine.\n\n4. Then, we will use [systemd](https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files) service to automate the process in the next part\n\nWanna update files later after you deploy your wbsite?\n\n1. You have to repeat the command **$cargo run --release** whenever you tweaked your Rust files.\n\n2. For static files such as HTML, CSS, JavaScript, Images and other simple files. You just substitute them and they will work.\n\nThe difference is that [Rust] is a compiled language and others are not.\n\n\u003cbr /\u003e\n\n## 5. Create systemd service for your Web application\n\nYou almost made it. We will refer to the [Rocket] for development environment to use it for systemd files.\n\nIt explains that there are development, staging and production environment and will be similar in other web frameworks.\n\nFor we are dealing with prodcution files and ready to deploy it to the web, only care for production part.\n\nWhen you use [Rocket], it already has its own default configuration and you would not need to edit that much.\n\nRead [its documenation] and find those parts in description will be used in **systemd service** later.\n\nIf you want to learn more about what **servie** mean here, you may refer to\n\n\"A service unit describes how to manage a service or application on the server. This will include how to start or stop the service, under which circumstances it should be automatically started, and the dependency and ordering information for related software\"\n\nfrom [here](https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files).\n\nThen, make **/etc/systemd/system/your-domain.tld.service** and write content in it similar to\n\n```bash\n[Unit]\nDescription=Web Application Example from steadylearner\n\n[Service]\nUser=www-data\nGroup=www-data\nWorkingDirectory=/home/yourname/yourwebsite/yourproject/\nEnvironment=\"ROCKET_ENV=prod\"\nEnvironment=\"ROCKET_ADDRESS=0.0.0.0\"\nEnvironment=\"ROCKET_PORT=8000\"\nEnvironment=\"ROCKET_LOG=critical\"\nExecStart=/home/yourname/yourwebsite/yourproject/target/release/yourproject\n\n[Install]\nWantedBy=multi-user.target\n```\n\nYou should find the right path for your project and everything is ready.\n\nTest in your virtual machien console with\n\n```console\n$sudo systemctl start your-domain.tld.service.\n```\n\nThat will make your [Rocket] or other framework you use to compile production files and serve them to port instead of you.\n\nYou may visit your domain your-domain.tld at this point.\n\nIf you want, you can save the command similar to\n\n```bash\nalias verifywebsite=\"curl curl https://www.steadylearner.com\"\n```\n\nin your ~/.bashrc file or you can use **$ping** instead if you are familiar with Linux Commands.\n\nThe result will be response from Nginx or your production web pages if you could make it work.\n\nYou can verify the real exmaple at [Steadylearner].\n\n**Hope you made it.**\n\nYou may write more alias in your **~/.bashrc** similar to\n\n```bash\n# ufw firewall(install ufw first)\nalias allownginx=\"sudo ufw allow 'Nginx Full'\"\nalias reloadufw=\"sudo ufw reload\"\n\n# systemd service\nalias start=\"sudo systemctl start yourdomain.tld.service\"\nalias stop=\"sudo systemctl stop yourdomain.tld.service\"\nalias status=\"sudo systemctl status yourdomain.tld.service\"\nalias reload=\"sudo systemctl daemon-reload\"\n# It works automatically for every reboot, use it just once.\nalias autoreload=\"sudo systemctl enable yourdomain.tld.service\"\n```\n\nThat was all to deploy your Rust Web application to the web with **Nginx** and **systemd** service in Linux Virtual Machine.\n\nYou may use other web frameworks also. You just need to edit the paths and configuration parts for it.\n\nIf you want to allow HTTPS for your website, please follow the next part.\n\n\u003cbr /\u003e\n\n## 6. HTTPS for your website\n\nWhat we need to enable https for our website are just a few lines of commands.\n\n```console\n$sudo certbot --nginx # 1.\n$sudo certbot renew --dry-run # 2.\n```\n\n1. Refer to the official documenation from [cerbot](https://certbot.eff.org/docs/using.html#nginx).\n\n2. Read [the documentation](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04) from DigitalOcean about **renew --dry -run** command\n\nFrom the first process with **$sudo certbot --nginx**, you will see the processes similar to\n\n[![https-cert](https://www.steadylearner.com/static/images/post/deploy/https-cert-process.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\n[![https-enable](https://www.steadylearner.com/static/images/post/deploy/https-enable-process.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\nIt would have shown certificate will expire later and you have to do some process for that.\n\nWe are ready for it. You just need to use **$sudo certbot renew --dry-run**.\n\n\u003cbr /\u003e\n\n[![https-renew](https://www.steadylearner.com/static/images/post/deploy/https-renew.png\n)](http://pages.news.digitalocean.com/dcn/AyKQ30vur1Nt8H30LIWxk-j5xHmafGnoECQwn1ooO76IYFHzigM_y4fqCVuHjuXsYYmKVEtVdAWxss0KUtUjfw==/DE3v00e0DIX002276X3M0VM)\n\n\u003cbr /\u003e\n\nYou can see that it is just simulating the renewal process in the description.\n\nThen, you can visit your website and [https is enabled][Steadylearner] for it.\n\n\u003cbr /\u003e\n\n## 7. Conclusion\n\nI know that it is not easy to follow this post.\n\nYou did well if you made it. Otherwise you can eventually achieve what you want.\n\nYou can deploy a web application made with **Rust**.\n\nI felt that there is nothing special in using Rust for web development with Nginx and Linux.\n\nOnly ports to serve files would be different from others and the rest of the process will be similiar.\n\nYou may do the same for other programming languages and frameworks also.\n\nWhat you learnt is how to use Nginx and systemld for whatever web frameworks written in any programming languages.\n\n**Thanks and please share this post with others**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteadylearner%2Frust-web-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteadylearner%2Frust-web-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteadylearner%2Frust-web-app/lists"}