自用备忘服务器部署、数据库命令、nginx命令/代理配置等

自用备忘

nginx 1.19.0

启动命令 /usr/local/nginx/sbin/nginx
查看端口 ps -ef | grep nginx
重新加载 ./sbin/nginx -s reload
停止服务 ./sbin/nginx -s stop
启动命令 ./sbin/nginx -c /usr/local/nginx/conf/nginx.conf

mysql

查看端口占用:netstat -tulpn
查看状态:sudo systemctl status mysqld
服务器启动时启动:sudo systemctl enable mysqld
禁止在启动时启动:sudo systemctl disable mysqld
启动:systemctl mysql start
停止:systemctl mysql stop
重启:systemctl mysql restart
关闭防火墙:systemctl stop firewalld
开启防火墙:systemctl start firewalld

linux设置开放端口

查看开放端口:firewall-cmd --list-ports
设置开放端口:firewall-cmd --zone=public --add-port=3306/tcp --permanent
重启防火墙:systemctl reload firewalld
查看防火墙当前状态:systemctl status firewalld
关闭防火墙:systemctl stop firewalld
开启防火墙:systemctl start firewalld

启动jar

nohup java -jar ***.jar >temp.txt 2>&1 &

启动Node

安装 forever启动依赖
forever start -a -l forever.log -o out.log -e error.log index.js

Git

push:git push origin main
提示网络问题:git config http.sslVerify “false”

本机WindowsMySQL

mysqld --initialize --console
mysqld --install mysql8

启动 SQL :net start mysql8
暂停 SQL 服务:net pause mysql8
重新启动 SQL 服务: net continue mysql8
停止 SQL 服务:net stop mysql8
删除 SQL sc delete mysql8
访问数据库 mysqld -u<用户名> -p<密码>
修改初始化密码 ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘新密码’;
查看数据编码 show variables like “%chara%”;
连接到 mysql 数据库,查看默认所有数据库信息 : show databases;

nginx代理配置

server {
		# ssl配置
        listen 443 ssl;
        root   html/Web;
        index  index.html;
        server_name www.***.top;
        ssl_certificate cert/***.top.pem;
        ssl_certificate_key cert/***.top.key; 
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
		# 文件压缩
		gzip on;
        gzip_disable "msie6";
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain application/css text/css application/xml text/javascript application/javascript application/x-javascript;

        location /api/ {
            proxy_pass http://www.***.top:***;
        }
        location / {
            root   html/Web;
            index  index.html;
            try_files $uri $uri/ /index.html;
        }
        #头像文件代理
        location /data/avatar {  
            expires 24h;  
            root /data/avatar/;#指定图片存放路径  
            proxy_store on;  
            proxy_store_access user:rw group:rw all:rw;  
            proxy_temp_path         /data/avatar/;#代理临时路径
            proxy_redirect          off;  
 
            proxy_set_header        Host 127.0.0.1;  
            proxy_set_header        X-Real-IP $remote_addr;  
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;  
            client_max_body_size    10m;  
            client_body_buffer_size 1280k;  
            proxy_connect_timeout   900;  
            proxy_send_timeout      900;  
            proxy_read_timeout      900;  
            proxy_buffer_size       40k;  
            proxy_buffers           40 320k;  
            proxy_busy_buffers_size 640k;  
            proxy_temp_file_write_size 640k;  
            if (!-e $request_filename) {  
                 proxy_pass  http://127.0.0.1:***;#代理访问地址  
            }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # 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;
        #}
    }

我的腾讯云 nginx server配置

listen 443 ssl;
root html/Web;
index index.html;
server_name www.;
ssl_certificate cert/
.pem;
ssl_certificate_key cert/***.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;

location /api/ {
proxy_pass http://***:8080/;
}
location / {
root html/Web;
index index.html;
try_files $uri $uri/ /index.html;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值