V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  programV2  ›  全部回复第 61 页 / 共 75 页
回复总数  1491
1 ... 57  58  59  60  61  62  63  64  65  66 ... 75  
@dndx 检查过了, 并且 docker 所有容器已经重启过了, 还有我进 nginx 容器内执行 netstat -tnlp, 发现 v4 的 80 和 443 都在监听, 但是我 nginx.conf 配置文件中只设置 listen 443;为什么还会监听 80 的端口呢??
nginx.conf`
server {
listen 443;
ssl on;
ssl_certificate /dir
@dndx 谢谢!但是我进 nginx 容器内执行 netstat -tnlp, 只有 tcp 的记录,没看到 tcp6 的记录, 这是为什么?

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.11:42303 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1/nginx: master pro
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
@dndx 谢谢 V 友, 有两个疑问:1.刚进 nginx 容器内执行 netstat -tnlp, 发现 v4 的 80 和 443 都在监听, 我 nginx.conf 配置文件中只设置 listen 443;为什么还会监听 80 的端口呢??

2.内核默认会把 v4 过来的地址转换成特殊的 v6 地址, 但是我 nginx 容器内只监听 v4 的地址,那是不是说系统还得把这个特殊的 v6 地址再次转换成 v4 地址才能与容器内的 nginx 服务通信?
@dndx
@cwbsw 谢谢两位指点. 就是说如果没有设置 BindIPv6Only 这个 tag 默认就是同时监听 ipv6 和 ipv4 端口吗? 另外还有一个疑问就是我用的容器,镜像中虽然映射了 80:80 和 443:443 端口, 但是我 nginx.conf 配置文件中只设置 listen 443; 为什么 80 端口还能访问( http 和 tcping 都 ok)??

docker-compose.yml 设置如下,
version: "3"
services:
nginx:
image: nginx:$NGINX_TAG
container_name: "${PROJECT_NAME}_nginx"
ports:
- 80:80
-443:443
2020-02-13 15:22:46 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@cdlnls 谢谢大佬回复 !端口和密码我都加固了, 之前安装网站时赶时间运行了 chmod -R 777, 现在是想把网站源码文件夹的 owner 改为 www-data 用户, 我刚进 nginx 容器发现没有 www-data 这个用户名,请问 nginx 服务访问 /project/web 用的是哪个用户名?



1.主机建了 3 个 docker 容器:Nginx,Drupal, MySQL, 其中 Nginx 和 Drupal 容器都是挂载到 ./project/web , 这样我是不是需要同时改这两个容器的 uid gid? 我现在在主机新建普通用户 foo: useradd -m -s -u 2005 -g 2005 foo , 还要分别进这两个容器执行下列命令吗?

usermod -u 2005 www-data
groupmod -g 2005 www-data
find / -user 82 -exec chown -h www-data {} \;
find / -group 82 -exec chgrp -h www-data {} \;




我 docker-compose.yml 部分设置如下
version: "3"
services:
nginx:
image: nginx:$NGINX_TAG
container_name: "${PROJECT_NAME}_nginx"
ports:
- $NGINX_PORTA

volumes:
- "./drupal/web:/var/www/html"
- "./drupal/logs/nginx:/var/log/nginx"
- "./drupal/nginx/nginx.conf:/etc/nginx/conf.d/default.conf"
- "./drupal/cloudflare:/etc/ssl"
depends_on:
- php

drupal:
image: drupal:$DRUPAL_TAG
container_name: "${PROJECT_NAME}_drupal"
volumes:
- "./drupal/web:/var/www/html"
- "./drupal/mysql:/var/lib/mysql"
restart: always
depends_on:
- mysql
2020-02-11 21:21:43 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@anguiao 谢谢 ! 请问 1.我现在在主机新建普通用户 foo: useradd -m -s -u 2005 -g 2005 foo , 我建了 3 个 docker 容器:Nginx,Drupal, MySQL, 其中 Nginx 和 Drupal 容器都是挂载到 ./project/web , 这样我是不是需要同时改这两个容器的 uid gid? 分别进这两个容器执行下列命令吗?

usermod -u 2005 www-data
groupmod -g 2005 www-data
find / -user 82 -exec chown -h www-data {} \;
find / -group 82 -exec chgrp -h www-data {} \;

ps: 我刚进 nginx 容器发现没有 www-data 这个用户名,请问 nginx 服务访问 /project/web 用的是哪个用户名?

2. 改完 uid gid 后我在主机上执行 chmod -R 755 ./project/web 及 chown -R foo:foo ./project/web
为了减少网站被黑掉或挂马的危险, 还有什么地方该加固的吗? 我主机已经改成证书登陆了. 谢谢 V 友指点!
2020-02-11 17:30:43 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@litanid
@saytesnake 我 docker-compose.yml 部分设置如下
version: "3"
services:
nginx:
image: nginx:$NGINX_TAG
container_name: "${PROJECT_NAME}_nginx"
ports:
- $NGINX_PORTA

volumes:
- "./drupal/web:/var/www/html"
- "./drupal/logs/nginx:/var/log/nginx"
- "./drupal/nginx/nginx.conf:/etc/nginx/conf.d/default.conf"
- "./drupal/cloudflare:/etc/ssl"
depends_on:
- php

drupal:
image: drupal:$DRUPAL_TAG
container_name: "${PROJECT_NAME}_drupal"
volumes:
- "./drupal/web:/var/www/html"
- "./drupal/mysql:/var/lib/mysql"
restart: always
depends_on:
- mysql
2020-02-11 17:17:57 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@saytesnake 谢谢V友指点! 我建了 3 个 docker 容器:Nginx,Drupal, MySQL, 其中 Nginx 和 Drupal 容器都是挂载到 ./project/web , 直接 chown -R 82.82 /project/web 那我 nginx 容器不就无法访问这个数据卷了吗 ? 刚进 nginx 容器发现没有 www-data 这个用户名,请问 nginx 服务访问 /project/web 用的是哪个用户名?


@litanid V 友,我刚进 nginx 容器发现没有 www-data 这个用户名,请问 nginx 服务访问 /project/web 用的是哪个用户名?
2020-02-11 17:02:09 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@litanid 谢谢 V 友指点! 请问 1.我现在在主机新建普通用户 foo: useradd -m -s -u 2005 -g 2005 foo , 我建了 3 个 docker 容器:Nginx,Drupal, MySQL, 其中 Nginx 和 Drupal 容器都是挂载到 ./project/web , 这样我是不是需要同时改这两个容器的 uid gid? 分别进这两个容器执行下列命令吗?

usermod -u 2005 www-data
groupmod -g 2005 www-data
find / -user 82 -exec chown -h www-data {} \;
find / -group 82 -exec chgrp -h www-data {} \;

2. 改完 uid gid 后我在主机上执行 chmod -R 755 ./project/web 及 chown -R foo:foo ./project/web
为了减少网站被黑掉或挂马的危险, 还有什么地方该加固的吗? 我主机已经改成证书登陆了. 谢谢 V 友指点!
2020-02-10 23:02:56 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@litanid 谢谢 V 友回复!我刚查了下容器外的 www-data 是
uid=33(www-data) gid=33(www-data) groups=33(www-data)

而容器内 www-data 是
uid=82(www-data) gid=82(www-data) groups=82(www-data),82(www-data)

我只要改 uid 和 gid 就可以了吗? 后面的 groups=82(www-data),82(www-data) 不用管他吗?

另外想请问我容器外主机上部署容器是用 root 用户, 容器内运行用户默认也是 root, 这样有什么安全风险? 除了把挂载主机目录./project/web 的 owner 改成 www-data 及 chmod -R 755 ./project/web 外该如何加固?        

@saytesnake
2020-02-10 20:14:31 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@jinliming2 不行, 我试过安装网站时报错提示没权限

@litanid@anguiao 谢谢! 那我直接 id命令查看www-data的 UID 和 GID , 如果不一样, 再用 usermod groupmod 把主机上的用户 改成跟容器里的一样, 就行了吧? 改里面或者外面 的 uid 应该没区别吧?
2020-02-10 16:29:41 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@phy25 谢谢回复! 我用的容器是 drupal:8.5.5-fpm-alpine, drupal8 在 ubuntu 上搭建的话用户权限 owner 要设置为 www-data, 装进容器后是不是也是 www-data?
@momocraft 谢谢. 我主要的困惑是 drupal8 在 ubuntu 上搭建的话用户权限 owner 要设置为 www-data, 装进容器后是不也是 www-data?
2020-02-09 17:19:29 +08:00
回复了 whileFalse 创建的主题 问与答 有多少同学买了 2c8g5m 安装 windows 当云电脑用的?
@falcon05 说起向日葵,之前用过他们家有那个远程控制的软件。现在开始收费了吗? https://sunlogin.oray.com/enterprise/remote
2020-02-09 15:16:44 +08:00
回复了 whileFalse 创建的主题 问与答 有多少同学买了 2c8g5m 安装 windows 当云电脑用的?
@aabbcc112233 谢谢 那请问你们是直接用路由器开端口映射吗? 也就是说你出门在外的时候要打开智能插座 App (通过智能插座厂商的服务器)进行开启电源?
我这样理解对吗?
@falcon05 谢谢。frp 是实现端口转发,你 frp 服务端是部署在哪个设备上?也就是说你出门在外的时候要打开智能插座 App (通过智能插座厂商的服务器)进行开启电源?
我这样理解对吗?
2020-02-09 14:45:40 +08:00
回复了 whileFalse 创建的主题 问与答 有多少同学买了 2c8g5m 安装 windows 当云电脑用的?
@aabbcc112233 各位 V 友好,我的家宽有公网 IP。请问 FRP 你是部署在路由器上吗?谢谢。🙏远程唤醒的话需要电脑主板跟网卡支持远程唤醒功能吧?
@falcon05
@aloyuu
2020-02-08 13:04:20 +08:00
回复了 zhuwd 创建的主题 问与答 苹果手机有办法同时接收两个微信的信息吗
@soinman 这个随便一个微信号都可以登录微信企业版吗?还有什么门槛?
2020-02-08 00:52:32 +08:00
回复了 programV2 创建的主题 程序员 Drupal 迁移到 Docker,求问如何在 Docker 容器里安装 drush?谢谢
@hefish 谢谢大佬回复! 我跑了 3 个容器,一个容器跑 Mysql,一个容器跑 php 另外一个 nginx, 在 php 的环境里再跑 drupal,我在 docker-compose.yml 中的 php 和 mysql 都设置了 volumes: -."/drupal/mysql:/var/lib/mysql" , 这样理论两个容器之间就可以互相访问了, 又在 php 容器上手动安装了 drush, 然后现在登陆进 php 容器执行 ./drush --uri=http://serebiomedical.com pm-uninstall -y captcha 报错如下, 这个有可能是什么原因呢?
因为 drush 命令涉及到要访问 mysql 容器, 是还要再加什么参数吗?
另外大佬您方便的话可不可以帮我看看上面#10 楼我贴出的报错日志. 万分感谢! 

Command pm-uninstall needs a higher bootstrap level to run - you will need [error]
to invoke drush from a more functional Drupal environment to run this
command.
The drush command 'pm-uninstall captcha' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for details.
* connect the database through a socket. The socket file may be wrong or
the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.
* connect to the database through a cli command using the
--defaults-extra-file parameter to pass credentials through a tmp file.
This method can break if other credentials are specified in a ~/.my.cnf
file in your home directory. You may have to delete or rename the
~/.my.cnf file in your home directory.
1 ... 57  58  59  60  61  62  63  64  65  66 ... 75  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2947 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 29ms · UTC 10:41 · PVG 18:41 · LAX 03:41 · JFK 06:41
Developed with CodeLauncher
♥ Do have faith in what you're doing.