@@ -9,14 +9,14 @@ comments: true
99![ Llordà's castle] ( /assets/images/infrastructure_castle_2.png )
1010
1111After some security setup I talked about on the
12- [ previous post] ( https://jordifierro.com /building-my-own-infrastructure-2 ) ...
12+ [ previous post] ( https://jordifierro.dev /building-my-own-infrastructure-2 ) ...
1313let's start with the applications!
1414I will only talk about two of them here (others follow similar pattern):
1515My blog web and Pachatary mobile application.
1616
1717## My blog
1818
19- [ jordifierro.com ] ( https://jordifierro.com )
19+ [ jordifierro.dev ] ( https://jordifierro.dev )
2020
2121This is a website created with Jekyll so its statics must be builded from source code.
2222
@@ -25,7 +25,7 @@ Here I paste the instructions to mount it on the server:
2525First, add an ` A Record ` from your domain to the server ip.
2626Then, generate an ssl certificate with certbot tool:
2727``` bash
28- sudo certbot certonly --manual --preferred-challenges=dns --email=myemail@gmail.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d " *.jordifierro.com " -d jordifierro.com
28+ sudo certbot certonly --manual --preferred-challenges=dns --email=myemail@gmail.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d " *.jordifierro.dev " -d jordifierro.dev
2929```
3030
3131This is the ` nginx.conf ` for this project:
@@ -34,10 +34,10 @@ This is the `nginx.conf` for this project:
3434server {
3535 listen 127.0.0.1:80;
3636
37- root /var/www/jordifierro.com /html;
37+ root /var/www/jordifierro.dev /html;
3838 index index.html index.htm index.nginx-debian.html;
3939
40- server_name jordifierro.com www.jordifierro.com ;
40+ server_name jordifierro.dev www.jordifierro.dev ;
4141
4242 location / {
4343 try_files $uri $uri .html $uri /index.html /index.html;
@@ -47,23 +47,23 @@ server {
4747
4848Setup it:
4949``` bash
50- sudo cp server-setup/blog/nginx.conf /etc/nginx/sites-available/jordifierro.com
51- sudo rm /etc/nginx/sites-enabled/jordifierro.com
52- sudo ln -s /etc/nginx/sites-available/jordifierro.com /etc/nginx/sites-enabled/
50+ sudo cp server-setup/blog/nginx.conf /etc/nginx/sites-available/jordifierro.dev
51+ sudo rm /etc/nginx/sites-enabled/jordifierro.dev
52+ sudo ln -s /etc/nginx/sites-available/jordifierro.dev /etc/nginx/sites-enabled/
5353sudo systemctl reload nginx
5454```
5555
56- And finally build and deploy the static files under ` /var/www/jordifierro.com `
56+ And finally build and deploy the static files under ` /var/www/jordifierro.dev `
5757using a docker jekyll images and volumes:
5858``` bash
5959git clone https://github.com/jordifierro/jordifierro.github.io.git
6060cd jordifierro.github.io
6161sudo mkdir -p .jekyll-cache _site
6262sudo docker run --rm -t --volume=" $PWD :/srv/jekyll" --env JEKYLL_ENV=production jekyll/jekyll:3.8 bash -c " jekyll build --trace"
6363cd ..
64- sudo mkdir -p /var/www/jordifierro.com /html
65- sudo chown -R $USER :$USER /var/www/jordifierro.com /html
66- sudo mv jordifierro.github.io/_site/* /var/www/jordifierro.com /html/
64+ sudo mkdir -p /var/www/jordifierro.dev /html
65+ sudo chown -R $USER :$USER /var/www/jordifierro.dev /html
66+ sudo mv jordifierro.github.io/_site/* /var/www/jordifierro.dev /html/
6767```
6868
6969## Pachatary
@@ -259,7 +259,7 @@ defaults
259259
260260frontend jordifierro
261261 bind SERVER_IP:80
262- bind SERVER_IP:443 ssl crt /etc/haproxy/certs/jordifierro.com .pem crt /etc/haproxy/certs/pachatary.com.pem
262+ bind SERVER_IP:443 ssl crt /etc/haproxy/certs/jordifierro.dev .pem crt /etc/haproxy/certs/pachatary.com.pem
263263 redirect scheme https code 301 if ! { ssl_fc }
264264 mode http
265265 option forwardfor header X-Real-IP
@@ -281,7 +281,7 @@ backend pachatary_api
281281` ` `
282282
283283This HAProxy config has 2 paths.
284- The default one redirects to system Nginx (jordifierro.com ),
284+ The default one redirects to system Nginx (jordifierro.dev ),
285285where each server config will serve appropriate files.
286286The other is for pachatary.com domain.
287287It load balances the requests to the two different docker containers
@@ -293,7 +293,7 @@ with the desired format:
293293` ` ` bash
294294sudo mkdir -p /etc/haproxy/certs
295295sudo cat /etc/letsencrypt/live/pachatary.com/fullchain.pem /etc/letsencrypt/live/pachatary.com/privkey.pem > /etc/haproxy/certs/pachatary.com.pem
296- sudo cat /etc/letsencrypt/live/jordifierro.com /fullchain.pem /etc/letsencrypt/live/jordifierro.com /privkey.pem > /etc/haproxy/certs/jordifierro.com .pem
296+ sudo cat /etc/letsencrypt/live/jordifierro.dev /fullchain.pem /etc/letsencrypt/live/jordifierro.dev /privkey.pem > /etc/haproxy/certs/jordifierro.dev .pem
297297` ` `
298298
299299Let' s restart HAProxy to apply changes:
@@ -304,5 +304,5 @@ systemctl restart haproxy
304304To get more information about all the setup you can visit the
305305[server-setup](https://github.com/jordifierro/server-setup) Github repository.
306306
307- On the [last post](https://jordifierro.com /building-my-own-infrastructure-4)
307+ On the [last post](https://jordifierro.dev /building-my-own-infrastructure-4)
308308I will explain how I use Jenkins to handle server tasks!
0 commit comments