nginx

How do I run uWSGI as a limited-access user?

倖福魔咒の 提交于 2021-02-07 19:16:52
问题 I have Django setup in NGINX + uWSGI. I'm able to get it running fine under my current logged in user (with help from a question I asked few days back) but now I want to run uwsgi --ini uwsgi.ini as a limited-access user . Here is what I've done so far: 1. Created a user djangouser without login access and without a home directory. 2. Added user nginx into group djangouser 3. Placed my django files into /mnt/django directory and changed file permissions of django to drwxrwx--- djangouser

通过SignalR技术整合即时通讯(IM)在.NET敏捷开发框架中落地

泪湿孤枕 提交于 2021-02-07 18:48:04
1、引言 **即时通讯(IM)**是RDIFramework.NET敏捷开发框架全新提供的一个基于Web的即时通讯、内部聊天沟通的工具。界面美观大方对于框架内部进行消息的沟通非常方便。基于RDIFramework.NET敏捷开发框架的即时通讯IM支持常规的用户对用户(点对点)聊天、工作流程流转的提醒、服务端消息的推送等。消息到达还有类似QQ的声音提醒,同时对消息进行了持久化处理,即时离线的用户,上线后也会收到消息,不会造成消息的丢失。还提供了很多扩展接口供用户实际扩展使用,非常的强大,方便。 通过“企业内部聊天IM”我们可以扩展很多应用出来。这儿特别说明的是我们的IM使用的是SignalR技术。.NET SignalR 是为.NET 开发人员提供的一个库,可以简化开发人员将实时 Web 功能添加到应用程序的过程。实时 Web 功能是指这样一种功能:当所连接的客户端变得可用时服务器代码可以立即向其推送内容,而不是让服务器等待客户端请求新的数据。什么是实时通信的Web呢?就是让客户端(Web页面)和服务器端可以互相通知消息及调用方法,当然这是实时操作的。SignalR提供了非常简单易用的高阶API,使服务器端可以单个或批量调用客户端上的JavaScript函数,并且非常方便地进行连接管理,例如客户端连接到服务器端,或断开连接,客户端分组,以及客户端授权,使用SignalR都非常

containerized nginx log rotation with logrotate

一曲冷凌霜 提交于 2021-02-07 14:57:58
问题 Nginx doesn't have native log rotation, so an external tool, such as logrotate, is required. Nginx presents a challenge in that the logs have to be reopened post rotation. You can send a USR1 signal to it if the pid is available in /var/run. But when running in a docker container, the pid file is missing in /var/run (and the pid actually belongs to the host, since it is technically a host process). If you don't reopen the logs, nginx doesn't log anything at all, though it continues to

uWSGI listen queue of socket full

可紊 提交于 2021-02-07 14:03:47
问题 My setup includes Load Balancer (haproxy) with two nginx servers running Django. Server 2 works fine but sometimes server 1 will start crashing and log will be full of *** uWSGI listen queue of socket ":8000" (fd: 3) full !!! (101/100) *** message. How do I go about resolving this issue? 回答1: Your listen queue is full. When you run uwsgi, pass it --listen 1024 to increase the queue to 1024. Note that a larger queue makes you more susceptible to a DDoS attack. You may also need to increase net

NGINX try_files does not pass to PHP

此生再无相见时 提交于 2021-02-07 13:42:59
问题 I have a very simple PHP site: . ├── about.php ├── index.php ├── project │ ├── project_one.php │ └── project_two.php └── projects.php And the following nginx config (only relevant parts shown): location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/path/to/php.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_intercept_errors on; } location / { index index.php; try_files $uri $uri/ $uri.php =404; } Hitting the / works as expected. Hitting any of the http

NGINX try_files does not pass to PHP

半世苍凉 提交于 2021-02-07 13:41:58
问题 I have a very simple PHP site: . ├── about.php ├── index.php ├── project │ ├── project_one.php │ └── project_two.php └── projects.php And the following nginx config (only relevant parts shown): location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/path/to/php.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_intercept_errors on; } location / { index index.php; try_files $uri $uri/ $uri.php =404; } Hitting the / works as expected. Hitting any of the http

宿主主机如何访问虚拟机中的docker服务

我只是一个虾纸丫 提交于 2021-02-07 12:54:17
宿主主机如何访问虚拟机中的docker服务 网上的回答不一而足,然而都没有解决,最后上了Stack Overflow,找到了答案,国内的小伙伴还得加油呀. 环境 宿主机系统 : window 8, 虚拟机软件: Oracle VirtualBox (CentOS7) docker version: 19.03.7 问题描述 虚拟机内部 systemctl start docker 启动docker , docker run -d -p 80:80 nginx 启动nginx 服务, 虚拟机ip 192.168.56.200 ,docker 服务ip 172.17.0.16 宿主机浏览器 localhost:81 无法访问nginx . 解决方法: 打开virtualbox 选择docker服务所在的虚拟机 点击设置 -> 网络 选择 NAT 网卡 点击高级 -> 端口转发 6 添加规则 : tcp 协议 ,主机和子系统端口设置,如 host:80 guest:80 浏览器访问 localhost:80 ,可以查看到nginx 界面 原文: 1. Open Oracle VM VirtualBox Manager 2. Select the VM used by Docker 3. Click Settings -> Network 4. Adapter 1 should

docker 访问宿主机网络

爷,独闯天下 提交于 2021-02-07 12:54:00
使用宿主机IP 在安装Docker的时候,会在宿主机安装一个虚拟网关 docker0 ,我们可以使用宿主机在 docker0 上的IP地址来代替 localhost 。 首先,使用如下命令查询宿主机IP地址: ifconfig 可以发现宿主机的IP是 172.17.0.1 ,那么将 proxy_pass http://localhost:1234 改为 proxy_pass http://172.17.0.1:1234 就可以解决 502 Bad Gateway 错误。 但是,不同系统下宿主机的IP是不同的,例如Linux下一般是 172.17.0.1 , macOS下一般是 192.168.65.1 ,并且这个IP还可以更改。所以使用IP配置 nginx.conf ,不能跨环境通用。 使用host网络 Docker容器运行的时候有 host 、 bridge 、 none 三种网络可供配置。默认是 bridge ,即桥接网络,以桥接模式连接到宿主机; host 是宿主网络,即与宿主机共用网络; none 则表示无网络,容器将无法联网。 当容器使用 host 网络时,容器与宿主共用网络,这样就能在容器中访问宿主机网络,那么容器的 localhost 就是宿主机的 localhost 。 在docker中使用 --network host 来为容器配置 host 网络: docker

nginx keepalive and dns resolver

走远了吗. 提交于 2021-02-07 12:50:24
问题 I have a nginx instance in AWS that has upstream Application layer. There are two requirements for nginx - keepalive - use resolver to dynamically resolve the upstream I am able to make either of them work. Here is the config for making keepalive work: upstream "backend" { server "appserver.example.com:443"; keepalive 250; } server { resolver 10.0.0.2 valid=60s; server_name _; location / { proxy_http_version 1.1; proxy_pass https://backend; } } Here is the config for DNS resolver to work: