Deploying the Beego application with Nginx
In the previous recipe, we learned how we can run the Beego application locally. In this recipe, we will be deploying the same application with Nginx
.
Getting ready…
This recipe assumes you have Nginx
installed and running on port 80
. For me, it's installed at /Users/ArpitAggarwal/nginx
.
How to do it…
- Open the Nginx configuration file at
/Users/ArpitAggarwal/nginx/conf/nginx.conf
and replace thelocation
block underserver
with the following content:
location / { # root html; # index index.html index.htm; proxy_pass http://localhost:8080/; }
- Start Nginx by executing the following command:
$ cd /Users/ArpitAggarwal/nginx/sbin $ ./nginx
- Run the Beego application by executing the following command:
$ bee run
How it works…
Once the command has executed successfully, browsing http://localhost:80/
will render the welcome page of the application, as shown in the following screenshot:
