我已经在主文件夹下configuration了php-fpm和nginx进行开发,并且我一直无法解决权限问题。 看起来php7.1-fpm.sock仍然拒绝连接,即使所有权限看起来都是正确的。 错误: root@xps:/var/log/nginx# cat error.log 2017/05/29 00:41:23 [crit] 27326#27326: *1 connect() to unix:/run/php/php7.1-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: sub.tld.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.1-fpm.sock:", host: "sub.tld.com" 每次尝试访问Web根目录时都会发生这种情况,该根目录应显示: <?php echo phpinfo(); ?> 在浏览器窗口中。 nginx.conf user darin darin; […] sub.tld.com.conf用于nginx server_name sub.tld.com root /home/darin/www […] location ~ \.php$ { […]
我有困难configuration反向代理将用户从http://localhost/nexus/到http://localhost:8081/ 。 我目前的nginx.conf如下所示: worker_processes 4; events { worker_connections 1024; } http { server { listen 80; location /nexus/ { proxy_pass http://localhost:8081/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } } 当我点击http://localhost/nexus/ ,它部分呈现页面。 当我检查HTML源代码时,我注意到JavaScript链接,图像链接和样式表链接没有正确构build。 例如,我看到这个: <link rel="stylesheet" type="text/css" href="http://localhost/static/rapture/resources/loading-prod.css?_v=3.3.1-01"> <script type="text/javascript" src="http://localhost/static/rapture/baseapp-prod.js?_v=3.3.1-01"></script> <img id="loading-logo" src="http://localhost/static/rapture/resources/images/loading-logo.png?_v=3.3.1-01"/> …但是,应该是这样的: – <link rel="stylesheet" type="text/css" href="http://localhost/nexus/static/rapture/resources/loading-prod.css?_v=3.3.1-01"> […]
我需要使用很多规则的redirect地图(2k +行,文件大小是〜200K) 我在nginx中有以下设置: map $uri $new_uri { include /etc/nginx/conf.d/redirects.map; } server { listen 80 default_server; listen [::]:80 default_server; # redirects if ($new_uri) { rewrite ^ $new_uri permanent; } 如此处所述,并在此处find。 问题:configtest失败: nginx: [emerg] could not build map_hash, you should increase map_hash_bucket_size: 64 我试图将map_hash_max_size和map_hash_bucket_size增加到相当疯狂的值: map $uri $new_uri { map_hash_max_size 262144; map_hash_bucket_size 262144; include /etc/nginx/conf.d/redirects.map; } 但仍然有相同的错误(以'64'结尾)。 我select了这些值,使它们大于文件大小。 […]
我想在HTTP中提供customers_api (directory) 。 检查下面我目前的default.conf(我使用Nginx和Centos 7)。 我试过了我在这里find的所有例子,而不是工作。 server { listen 443 ssl http2; listen [::]:443 ssl http2; gzip off; root /usr/share/nginx/html; index index.php index.html index.htm; server_name example.org; location / { try_files $uri $uri/ =404; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { root […]
我正在使用SSH端口转发 – 如此精彩的插图和详细阐述 – 访问我的服务器。 我花了更多的时间,我想承认,解决为什么访问我的Python Web服务器404s。 全长问题在这里完成。 我的问题是,如果我使用端口转发直接将我的请求转发到Python服务器正在运行的端口(例如8282),所有的请求404。 Python服务器,为了简单起见(服务于一个index.html,包含stringhello ): python -m http.server 8282 从主机的SSH端口转发,我想获得访问权限: ssh -L 8181:<farawayhost-ip>:8282 <sshuser>@<remotehost-ip> 对于curl主机上的后续请求,我已经定义了环境variableshttp_proxy : export http_proxy=127.0.0.1:8181 显然这些请求是不正确的,因为它们被IP地址所占用。 为了比较,这里是Python http.server日志,首先从服务器本地访问,然后从外部主机使用SSH端口转发。 Serving HTTP on 0.0.0.0 port 8282 … <server-public-ip> – – [<timestamp>] "GET /index.html HTTP/1.1" 200 – <proxy-ip> – – [<timestamp>] code 404, message File not found <proxy-ip> – […]
我使用nginx与多个位置来指导请求到我的网站和我的api。 我使用certbot来生成SSL证书,并自动添加行到nginxconfiguration来configurationSSL。 这些文件是从html文件夹中提供的,没有任何问题,但是,任何对“redacted.org/api”的Web请求都会返回502 Bad Gateway。 就好像SSL未configuration为“/ api”位置,而是针对“/”位置。 我需要在我的configuration(下面)中更改这个工作? server { listen 80; server_name redacted.org www.redacted.org; location /api { proxy_pass http://localhost:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } location / { root /var/www/html; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/redacted.org/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/redacted.org/privkey.pem; […]
尽我所能,我不能禁止从PHP显示错误消息(使用php-fpm)。 相关文件; /etc/php5/fpm/php.ini:display_errors = Off /etc/php5/fpm/pool.d/www.conf:php_flag[display_errors] = off /etc/php5/fpm/pool.d/www.conf:php_admin_flag[display_errors] = off /etc/php5/cli/php.ini:display_errors = Off 当我打电话给phpinfo()输出如下[图片作为链接,因为这是我的第一篇文章,因此没有足够的声誉,把他们内联,对不起! /imgs/4ttGt.png /imgs/4LAah.png 上面显示configuration文件path为/etc/php5/fpm ,加载configuration文件为/etc/php5/fpm/php.ini 。 第二个图像显示display_errors和display_startup_errors Off 。 这表明这些设置已被正确设置,但加载一个错误的页面导致错误的页面,例如; 未知 :preg_replace():不推荐使用/ e修饰符,而是使用preg_replace_callback代替行651上的/path/to/file.php ****未知 :preg_replace():/ e修饰符不推荐使用,而是使用preg_replace_callback代替/第651行的path/到/ file.php (格式如上,所以HTML格式正在被应用) 我也尝试设置ini_set("display_errors", 0); 甚至error_reporting(0); 无济于事。 另外,编辑添加; # php5-fpm -i | grep error display_errors => Off => Off display_startup_errors => Off => Off error_append_string => […]
我家里有两台电脑。 computer1正在接收所有http(s)请求(从框中)并包含域domain1.com网站。 而computer2拥有域domain2.com网站。 所以我在computer1上的nginx的conf.d文件夹中添加了domain2.com.conf : server { listen 443; server_name *.domain2.com domain2.com; location / { proxy_pass https://192.168.1.22:$server_port/$uri$is_args$args; proxy_set_header Host $host:$server_port; } } 问题是,当我尝试访问domain2.com ,返回的SSL证书是来自domain1.com证书。 我search了谷歌的方式来表明SSL证书在哪里,我发现: ssl on; ssl_certificate <path_to_certificate>; ssl_certificate_key <path_to_certificate>; 但显然,问题是证书在computer2而不在计算机1上。 如何将SSL证书请求redirect到computer2 ? 我没有find解决办法,也许我有错误的关键字。 非常感谢你。 编辑1 :根据这个线程Nginx代理到后台用SSL客户端证书进行身份validation 。 我已经添加了这一行proxy_set_header X-SSL-CERT $ssl_client_cert; 到domain2.com.conf。 但它仍然没有工作。 EDIT2 :根据评论,这里是domain1.com的configuration文件:domain1.com.conf server { listen 80; listen [::]:80; server_name domain1.conf; access_by_lua_file […]
我需要将以下规则从apache转换为nginx: RewriteCond %{QUERY_STRING} id=([^&]*) [NC,OR] RewriteCond %{QUERY_STRING} daily=([^&]*) [NC] RewriteCond %{REQUEST_URI} !mobSpecCycle [NC] RewriteCond %{REQUEST_URI} !mobSpecTheme [NC] RewriteRule ^rss\/mobSpec([^\/]+)/?$ /rss/mobSpec$1/mobSpec$1_%1.html [QSA,NC,L] 例如重写 / RSS / mobSpecArticle /?ID = 26422 成 /rss/mobSpecArticle/mobSpecArticle_26422.html 我开始如下 if ($args ~ id=([^&]*)|daily=([^&]*)) { rewrite ^/rss\/mobSpec([^\/]+)/?$ /rss/mobSpec$1/mobSpec$1_$2.html last; } 但是我不知道如何在重写规则中取消id =([^&] *)? 我把$ 2放在那里,但它不工作… apache具有%1从RewriteCond反向引用匹配。 如何在后面的重写中从nginx的if()返回引用匹配? 任何想法如何可以添加最后两个条件? RewriteCond %{REQUEST_URI} !mobSpecCycle [NC] RewriteCond […]
在Winginx出现问题之前,一切都奏效了。 当我用POST方法发送数据与Jquery时,我得到405(不允许)错误。 GET工作得很好。 当我从/ formcheck请求数据(这是forcmcheck.php,并自行正常工作),我得到这个错误。 我没有改变Nginx的日志中的任何东西,除了重写引擎的几行。 你可以看到日志: 127.0.0.1 – – [07/Jun/2017:15:14:06 +0300] "POST /formcheck HTTP/1.1" 405 575 "http://music-portfolio.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" 127.0.0.1 – – [07/Jun/2017:15:16:35 +0300] "POST /formcheck HTTP/1.1" 405 575 "http://music-portfolio.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" 127.0.0.1 – […]