Personal Blog Construction

superorange 2022/05/28 483Views

Personal website construction

Required: server, domain name, halo package and materials, software (terimus, transmit)

problem:can't access the ip address
reason:firewall
check the status of the firewall:firewall-cmd --state

temporarily close:systemctl stop firewalld.service

disable service:systemctl disable firewalld.service 

1.install the environment

1.1 java environment

yum install java-11-openjdk -y

1.2 install Nginx

1.Put the installation package (nginx-1.17.10.tar.gz) into the root directory

  1. Create and enter the nginx folder under /usr/local/
cd /usr/local/
mkdir nginx
cd nginx
#install repository
yum -y install pcre-devel
yum -y install openssl openssl-devel
  1. Unzip to the nginx folder, and compile and install the configure file in the directory nginx-1.17.10 that appears after unzipping

    cd nginx-1.17.10
    ./configure
    make && make install
    
  2. Enter the sbin folder in the nginx directory and execute the executable file nginx

cd /usr/local/nginx/sbin
./nginx
  1. Modify the nginx config file
cd /usr/local/nginx/conf

open file - nginx.conf

find the content about serve,add the targethat needs to be mapped(default port of local address of halo:8090):

    upstream blog{
        server 127.0.0.1:8090;
    }

modify the internal location of server:

        location / {
            proxy_pass http://blog;
            proxy_set_header HOST $host;
            proxy_set_header X-Forward-Proto $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
        }
1.3 bind the public ip and domain name

server:racknerd

domain name:reg123

Add DNS records in reg123 DNS control panel

Hostname: @(No need to add anything before the domain name)
ipaddress:the public ip of the server

2.run halo.jar

nohup java -jar halo-1.4.17.jar &

You can see the process number when you open it, or get it by querying (eg halo-1.4.17.jar)

ps -aux | grep "halo-1.4.17.jar"

you can change it to something running within “” after grep

close it with kill the process

kill -9 process number