linux 常用软件重启

nginx启动

nginx安装:yum install -y nginx
关闭:nginx -s stop
带配置文件启动:nginx -c /etc/nginx/nginx.conf

nginx配置:nginx.conf
`user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
worker_connections 1024;
}

http {
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  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

include /etc/nginx/conf.d/*.conf;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
add_header X-Frame-Options DENY;
add_header X-Xss-Protection "1; mode=block;";
add_header X-Content-Type-Options "nosniff";
add_header Content-Security-Policy: "default-src 'self'";
add_header Public-Key-Pins 'pin-sha256="2R/ZHJL/jKO4oDQfQYqDaKCgOm9E3dpOHt+1/hUEk5U="; pin-sha256="2R/ZHJL/jKO4oDQfQYqDaKCgOm9E3dpOHt+1/hUEk5U="; max-age=63072000; includeSubDomains';

}
`
*.conf/xxxx.conf

`server {
listen 80;
server_name 127.0.0.1;
location / {
root /root/www/h5-management;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}

location /xxl-job-admin/ {
        proxy_pass http://172.17.0.3:7070/xxl-job-admin/;
        #root   html;
        index  index.html index.htm;
}

location /encrypt/ {
        proxy_pass http://127.0.0.1:9091/encrypt/;
        #root   html;
        index  index.html index.htm;
}

location /task/ {
        proxy_pass http://127.0.0.1:9094/task/;
        #root   html;
        index  index.html index.htm;
}


location /management {
proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Access-Control-Allow-Origin *;
proxy_http_version 1.1; #设置http版本为1.1
    proxy_set_header Connection ""; #设置http头默认为长连接,不关闭
proxy_pass http://localhost:9090/management;
}

}`

redis重启

如果是用apt-get或者yum install安装的redis,可以直接通过下面的命令停止/启动/重启redis
未尝试
/etc/init.d/redis-server stop

/etc/init.d/redis-server start

/etc/init.d/redis-server restart

如果是通过源码安装的redis,进入到安装目录
ps -ef|grep redis 查询redis的pid
kill -9 pid
redis-server redis-conf
验证启动状态:ps -ef|grep redis 或 ./redis-cli进入客户端,输入auth password登录,查询所有key命令;keys *

redis开机启动
vim /etc/systemd/system/redis.service
将下面的内容写入到系统服务文件中
[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking

这行配置内容要根据redis的安装目录自定义路径

ExecStart=/usr/local/bin/redis-server /usr/local/src/redis-6.2.6/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target

保存系统服务文件,然后输入命令,重载系统服务:systemctl daemon-reload
最后,执行下面的命令,实现开机自启:systemctl enable redis
查看此时,redis 服务的状态:systemctl status redis,systemctl start/restart redis

mysql重启

service mysqld restart

kafka重启

启动zookeeper

./bin/zookeeper-server-start.sh -daemon ./config/zookeeper.properties

待zookeeper启动正常后,启动kafka

./bin/kafka-server-start.sh -daemon ./config/server.properties

gitlab重启

启动gitlab服务

sudo gitlab-ctl start

gitlab服务停止

sudo gitlab-ctl stop

重启gitlab服务

sudo gitlab-ctl restart

jenkins重启

jenkins启动

service jenkins start

重启

service jenkins restart

停止

service jenkins stop

posted @ 2023-04-12 17:32  我看见的世界  阅读(106)  评论(0编辑  收藏  举报