docker宝塔设置nginx开机自启(docker启动nginx不能访问)

docker宝塔设置nginx开机自启(docker启动nginx不能访问)

扫码添加渲大师小管家,免费领取渲染插件、素材、模型、教程合集大礼包!

大家好,今天来介绍docker宝塔设置nginx开机自启(docker怎么启动nginx)的问题,以下是渲大师小编对此问题的归纳和整理,感兴趣的来一起看看吧!

docker启动nginx

访问 http:localhost:8080,可以看到安装成功。

把本地路径 /Users/zhangliyuan/Programming/nginxdk 挂载到 /etc/nginxdk 下。

容器内/etc/nginxdk没有,会自动创建。
如果/etc/nginxdk已经存在,启动则会报错,不适合挂载已存在文件的文件夹。

这个命令主要是方便把容器内的一些文件复制到挂载文件夹,方便宿主机查看。

如果想多挂载几兄森高春笑个配置文件,羡尺需要多写几个 -v

stop后,可以删除

dockercompose快速启动nginx

创建nginx目录,目录下创建docker-compose.yml文件如下:

nginx目录下扮哪创建创建nginx.conf文件,根据实际情况配置,我这里写厅银码一个示例:

在nginx目录下创建build目录,将前端静态文件拷贝到下边

在nginx目录下执行如下搏旦命令启动服务

启动之后,nginx就可以正常使用了。

chkconfig无法识别nginx如何设置nginx自启

假定你源码安装Nginx:
安装路径是/usr/local/nginx
否则变更下面路径的文件:
########################

nginx="/usr/local/nginx/sbin/nginx"
NGINX_CONF_FILE="/usr/local/nginx/conf/庆运nginx.conf"
################################

则将下面文件誉搜梁copy:
#cd /etc/init.d/
#vi nginx
粘贴刚才的内容。检查是不是完整
#chmod +x nginx
#chkconfig add nginx
#chkconfig nginx on
在Centos下是这样。其他类同。漏做

#!/bin/sh
#
#nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/local/nginx/sbin/nginx"
prog=$(basename $nginx)

NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"

lockfile=/var/lock/subsys/nginx

start() {
[ -x $nginx ] exit 5
[ -f $NGINX_CONF_FILE ] exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
configtest return $?
stop
start
}

reload() {
configtest return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}

force_reload() {
restart
}

configtest() {
$nginx -t -c $NGINX_CONF_FILE
}

rh_status() {
status $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}

case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q exit 0
$1
;;
restartconfigtest)
$1
;;
reload)
rh_status_q exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestarttry-restart)
rh_status_q exit 0
;;
*)
echo $"Usage: $0 {startstopstatusrestartcondrestarttry-restartreloadforce-reloadconfigtest}"
exit 2
esac

求docker启动容器怎么自动启动mysql php nginx服务

在这里得到的答案总物御是不实用,到后 盾 人平台上看看吧,上面关于问枣蚂态题有凳源详细的讲解.都是一线老师亲自授课

zookeeper/kafka设置开机自启/nginx安装部署

systemctl daemon-reload
systemctl enable zookeeper
启动zk:systemctl start zookeeper
停止zk:systemctl stop zookeeper
reboot 验证

安装目录:/usr/local/kafka_2.13-2.7.0/
数据目录:/kafka/data
服务端口:9092
设置开机启动:
/etc/systemd/system/ 文件夹下创建一个启动脚本 kafka.service
chmod 755 kafka.service
设置文件内容:

systemctl daemon-reload
systemctl enable kafka
启动:systemctl start kafka
停止:systemctl stop kafka

上传nginx安握迟装包
yum -y install gcc gcc-c++ autoconf automake make zlib-developenssl openssl-devel
tar -zxvf nginx-1.16.1.tar.gz
cd nginx-1.16.1/
./configure —prefix=/usr/local/nginx
make&&make install
cd /usr/local/nginx/sbin
./nginx
lsof -i:80
检查是否安装成功消皮洞: http://10.10.108.2:80/

设置开机自启:
/etc/systemd/system/ 文件夹下创建一个启动脚本 nginx.service
chmod 755 nginx.service
设置文件内容:

systemctl daemon-reload
systemctl enable nginx
启动:systemctl start nginx
停止:拿枯systemctl stop nginx
reboot 验证是否开机自启

分享到 :
相关推荐

免费海外vps有哪些优势(免费海外vps有哪些优势和劣势)

免费海外vps的优势有:1。海外vps不用备案。能节省繁琐的备案流程和建站时间成本;...

ubuntu远程连接拒绝访问(虚拟机拒绝了连接请求)

大家好,今天来介绍ubuntu远程连接拒绝访问的问题,以下是渲大师小编对此问题的归纳...

​美国网络服务器跟国内服务器对比有哪些优势(?美国网络服务器跟国内服务器对比有哪些优势)

=美国网络服务器跟国内服务器对比的优势:1.美国高防服务器免备案。省掉了绝大多数复[...

服务器如何使用(阿里云服务器如何使用)

使用服务器的操作步骤1.登录服务器提供商官网。点击“服务器”菜单。在服务器列表中选[...

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注