centos7 安装gitlab之后无法重启nginx,也无法停止

在 linode centos7 上安装gitlab-ce,安装之后默认的nginx被停止。 现在无法关闭gitlab自带的nginx,使用kill进程也是一样。

 

[root@linode nginx]# ps aux | grep nginx
root 4223 0.0 0.0 4188 792 ? Ss 21:53 0:00 runsv nginx
root 4224 0.0 0.0 4332 644 ? S 21:53 0:00 svlogd -tt /var/log/gitlab/nginx
root 4527 0.0 0.2 26888 4352 ? Ss 21:57 0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
gitlab-+ 4528 0.0 0.3 31140 7612 ? S 21:57 0:00 nginx: worker process
root 4918 0.0 0.1 112668 2272 pts/1 S+ 22:02 0:00 grep --color=auto nginx
[root@linode nginx]# 

 

 

gitlab-ctl 守护进程停止 nginx. 

 

gitlab-ctl stop nginx

 

 

gitlab-ctl 守护进程重新启动 nginx. 

gitlab-ctl restart nginx

 

 

### 在 CentOS 8 上安装配置 GitLab #### 准备工作 在开始之前,确保服务器已经更新到最新的状态,并关闭可能影响服务运行的防火墙和SELinux设置。可以通过以下命令来实现: ```bash sudo systemctl stop firewalld && sudo systemctl disable firewalld sudo setenforce 0 sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config ``` #### 添加 GitLab YUM 源 编辑 `/etc/yum.repos.d/gitlab-ce.repo` 文件,添加清华大学镜像源的内容[^1]: ```bash [root@localhost ~]# vim /etc/yum.repos.d/gitlab-ce.repo [gitlab-ce] name=Gitlab CE Repository baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/ gpgcheck=0 enabled=1 ``` 保存退出后刷新缓存: ```bash yum makecache ``` #### 安装 GitLab 软件包 执行以下命令以安装最新版本的 `gitlab-ce` 软件包[^2]: ```bash sudo EXTERNAL_URL="http://gitlab.example.com" dnf install -y gitlab-ce ``` 如果需要指定特定的历史版本,则可以替换 `{VERSION}` 参数为所需的版本号。 #### 配置外部 URL 和初始化 定义 GitLab 的访问地址(例如 http://your-domain-or-ip),通过设置变量 `EXTERNAL_URL` 来完成此操作。这一步非常重要,因为它决定了用户将来如何访问您的实例。 #### 启动并重新加载 GitLab 服务 一旦安装成功,首次启动 GitLab 并应用初始配置: ```bash sudo gitlab-ctl reconfigure ``` 等待几分钟直到进程结束。之后可通过浏览器输入设定好的域名或者 IP 地址验证是否正常运作[^3]。 #### SSL 设置 (可选) 为了增强安全性,建议启用 HTTPS 协议。这里提供一种基于 OpenSSL 手动生成自签名证书的方法作为参考: ##### 创建SSL目录结构及相关文件 ```bash mkdir -p /etc/gitlab/ssl chmod 700 /etc/gitlab/ssl cd /etc/gitlab/ssl openssl genrsa -out yourdomain.key 2048 # 替换为实际使用的主机名或IP openssl req -new -key yourdomain.key -out yourdomain.csr openssl x509 -req -days 365 -in yourdomain.csr -signkey yourdomain.key -out yourdomain.crt cat yourdomain.crt yourdomain.key > yourdomain.pem chown root:root *.key *.crt *.pem chmod 400 *.key *.crt *.pem ``` 最后调整 Nginx 或其他反向代理的相关部分指向新生成的 PEM 文件路径即可。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值