个人博客部署

作者:Keysqiu
创建时间:2025-11-30 18:19:01 最后一次修改时间:2025-12-02 15:58:52
Categories: Tags:

1、JDK17

wget http://49.232.8.65/jdk/jdk17/jdk-17_linux-x64_bin.tar.gz
tar -zxvf jdk-17_linux-x64_bin.tar.gz
vim /etc/profile
# 文件添加如下内容
export JAVA_HOME=jdk文件夹全路径
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
# 刷新配置使其生效
source /etc/profile
# 查看安装的版本
java -version

2、MySQL

具体教程可以参考

二 安装mysql

3、Redis

wget http://download.redis.io/releases/redis-6.2.7.tar.gz
tar -zxvf redis-6.2.7.tar.gz
cd redis-6.2.7
make
make PREFIX=/usr/local/src/redis-6.2.7 install
cp redis.conf /usr/local/src/redis-6.2.7/bin
vim redis.conf
# 文件修改如下内容
# 1、允许访问的地址,默认是127.0.0.1,会导致只能在本地访问。修改为0.0.0.0则可以在任意IP访问
bind 0.0.0.0
# 2、守护进程,修改为yes后即可后台运行
daemonize yes 
# 3、密码,设置后访问Redis必须输入密码
requirepass X7#kLp!2fQ@5z
# 启动Redis
cd /usr/local/src/redis-6.2.7/bin
./redis-server redis.conf

4、Nginx

具体教程可以参考

配置可以参考

HTTPS:

worker_processes  1;
 
events {
    worker_connections  1024;
}
 
 
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
 
    keepalive_timeout  65;
 
    # HTTPS server
    #
    server {
        listen       				443 ssl;
        server_name  				自己的域名或者云服务器IP;
 
        client_max_body_size 			5m;
 
        ssl_certificate      			云服务器.crt的ssl文件;
        ssl_certificate_key  			云服务器.key的ssl文件;
 
        ssl_session_cache    			shared:SSL:1m;
        ssl_session_timeout  			5m;
        ssl_protocols				TLSv1 TLSv1.1 TLSv1.2; 
 
        ssl_ciphers  				HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  		on;
 
        location / {
            root   /usr/local/nginx/html/dist;
            index  index.html index.htm;
            try_files 	$uri $uri/ /index.html;
        }
 
        location /admin {
            alias   /usr/local/nginx/html/admin/dist;
            index  index.html index.htm;
            try_files 	$uri $uri/ /admin/index.html;
        }
        
 
        location /api/{
        	proxy_pass http://[服务器地址]:8080/;
        }
    }
 
}

HTTP:

#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            root   /usr/local/nginx/html/dist;
            index  index.html index.htm;
            try_files $uri $uri/ /index.html;
        }
        #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location /admin {
            alias   /usr/local/nginx/html/admin/dist;
            index index.html index.htm;
            try_files $uri $uri/ /index.html;
        }
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
        location /api/{
            proxy_pass http://www.qiuqingsheng.fun:48080/;
        }
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}