小编Vij*_*man的帖子

SELinux启用时,proxy_pass无法正常工作,为什么?

我正在使用端口8080上的端口8081和Nginx监听应用程序.代理传递语句如下所示:

$ cat /var/etc/opt/lj/output/services/abc.servicemanager.conf

location /api/abc.servicemanager/1.0 { proxy_pass     http://localhost:8081;}
Run Code Online (Sandbox Code Playgroud)

nginx.conf,我将此文件包含为:

include /etc/nginx/conf.d/services/*.conf;
Run Code Online (Sandbox Code Playgroud)

/etc/nginx/conf.d/service是一个符号链接:

# ll /etc/nginx/conf.d/

lrwxrwxrwx. 1 root root   39 Dec 10 00:19 services -> ../../../var/etc/opt/lj/output/services
Run Code Online (Sandbox Code Playgroud)

这是一个CentOS 7.0 SELinux Enabled系统.如果我setenforce 0,并使它Permissive,我没有看到任何问题.所以文件在正确的位置,路径没有问题.如果SELinux正在执行,我在审计日志中看到以下内容:

type=AVC msg=audit(1418348761.372:100930): avc:  denied  { getattr } for  pid=3936 comm="nginx" path="/var/etc/opt/lj/output/services/abc.servicemanager.conf" dev="xvda1" ino=11063393 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file
Run Code Online (Sandbox Code Playgroud)

我想知道如何启用Nginx来查找conf文件而无需禁用SELinux.

reverse-proxy nginx selinux

16
推荐指数
4
解决办法
2万
查看次数

使用 Python 请求信任自签名证书

我的 apache ssl conf 具有以下配置

#   Server Certificate:
SSLCertificateFile /etc/pki/tls/certs/localhost.crt

#   Server Private Key:
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
Run Code Online (Sandbox Code Playgroud)

我没有此服务器的 CA 证书。我仍然可以将 localhost.crt 安装到我的客户端以成功验证我的服务器吗?

在客户端:我使用 Python 请求库 (2.2.1)。使用默认 CA BUNDLE 路径。即使我将 localhost.crt 添加到默认路径中的 cacert.pem 中,我也无法看到验证通过。我看到异常:

    File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 385, in send
    raise SSLError(e)
SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Run Code Online (Sandbox Code Playgroud)

我做错了什么吗?我应该只添加在服务器中签署 localhost.crt 的 CA 吗?

谢谢,维杰

python apache ssl python-requests

7
推荐指数
1
解决办法
6949
查看次数

返回修改字典的副本

我有一本字典,对于一个特定的键,我说了5个可能的新值.因此,我尝试使用一个简单的lambda函数创建原始字典的5个副本,该函数将替换该特定键的值并返回主字典的副本.

# This is the master dictionary.
d = {'fn' : 'Joseph', 'ln' : 'Randall', 'phone' : '100' }
# Joseph has got 4 other phone numbers
lst = ['200', '300', '400', '500']
# I want 4 copies of the dictionary d with these different phone numbers
# Later I would want to do some processing with those dictionary without affecting d
Run Code Online (Sandbox Code Playgroud)

所以我想这样做:

# y is the list I want to hold these copies of dictionaries with modified values
i …
Run Code Online (Sandbox Code Playgroud)

python lambda

4
推荐指数
1
解决办法
1192
查看次数

svn更改源库

我检查了svn存储库中的代码并开始进行更改.但现在存储库已重命名.如何将本地存储库映射到新命名的源存储库,然后对其运行svn命令.

svn

4
推荐指数
1
解决办法
3141
查看次数

Nginx代理传递 - 禁用ipv6

我有如下nginx conf:

server {
listen       127.0.0.1:8080;
server_name  127.0.0.1;

client_max_body_size 20m;

include /etc/nginx/conf.d/services/*.conf;

# redirect server error pages to the static page /50x.html                                                                                                                                              
#                                                                                                                                                                                                       
error_page   500 /500.json;
error_page   501 /501.json;
error_page   502 /502.json;
error_page   503 /503.json;
error_page   504 /504.json;
error_page   404 /404.json;

location = /500.json {
    root   /opt/lj/nginx;
}
location = /501.json {
    root   /opt/lj/nginx;
}
location = /502.json {
    root   /opt/lj/nginx;
}
location = /503.json {
    root   /opt/lj/nginx;
}
location = /504.json {
    root   /opt/lj/nginx;
}
location = /404.json { …
Run Code Online (Sandbox Code Playgroud)

reverse-proxy nginx ipv4 ipv6 proxypass

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

nginx ×2

python ×2

reverse-proxy ×2

apache ×1

ipv4 ×1

ipv6 ×1

lambda ×1

proxypass ×1

python-requests ×1

selinux ×1

ssl ×1

svn ×1