NGINX不会向浏览器提供CSS或JS文件 链接到页面(magento) http://836237.vps-10.com/ 访问日志显示: [01/Dec/2013:16:55:17 +0000] "GET /js/varien/form.js HTTP/1.1" 304 0 "http://836237.vps-10.com/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36" 错误日志显示没有错误。 以下是我的虚拟主机文件: server { listen 80 default_server; server_name 836237.vps-10.com; root /data/www/public_html/hotnstylish/public/; #charset koi8-r; access_log /data/www/public_html/hotnstylish/log/access.log; error_log /data/www/public_html/hotnstylish/log/error.log; location / { include /etc/nginx/mime.types; root /data/www/public_html/hotnstylish/public/; index index.html index.htm index.php; try_files $uri $uri/ @handler; ## […]
我已经用ISPconfig安装了nginx。 一切工作正常,除了一些网站,我已经从Apache服务器移植不幸有.php5扩展名,我不知道如何让Nginxparsing它们。 我已经尝试了许多解决scheme和变体,但仍然无法使其工作。 我会从文件中粘贴我的设置,如果有人有类似的经验,想分享,我会感激。 部分来自文件的设置: /etc/php5/fpm/php.ini cgi.fix_pathinfo = 0 在/ etc / nginx的/网站可用/默认 服务器{ 听80 default_server; 根/ usr / share / nginx / html; index index.html index.php index.htm; 位置 / { try_files $ uri $ uri / /index.html; } } 位置〜\ .php $ { #fastcgi_split_path_info ^(。+ \。php)(/.+)$; ##注意:你应该有“cgi.fix_pathinfo = 0;” 在php.ini中 # #单独使用php5-cgi: #fastcgi_pass 127.0.0.1:9000; […]
我有几台服务器为单个站点提供服务。 主服务器运行nginx和php-fpm。 所有其他服务器运行php-fpm。 运行nginx和php-fpm的服务器通过unix套接字连接,其他的通过tcp连接。 大概一个小时(不完全,有时更频繁),有一个奇怪的行为。 所有连接的nginx到php-fpm服务器超时。 它无法build立连接。 2014/03/24 04:59:09 [error] 2123#0: *925153 upstream timed out (110: Connection timed out) while connecting to upstream, client: <<client ip removed>>, server: www.example.com, request: "GET /some/address/here HTTP/1.1", upstream: "fastcgi://192.168.1.5:9000", host: "www.example.com", referrer: "http://www.example.com/some/address/here" 2014/03/24 04:59:09 [error] 2124#0: *926742 connect() to unix:/tmp/php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to […]
我在我的服务器日志中发现一个PHP错误,说: [02:09:27 UTC] PHP致命错误:带有消息'SQLSTATE [HY000] [2002]的未捕获的exception'PDOException'/var/www/include/db_connect.php:7中没有这样的文件或目录 堆栈跟踪: `#0 /var/www/include/db_connect.php(7):PDO – > __ construct('mysql:dbname = my …','apache','123 …') 进一步的检查显示,这个错误发生在服务器启动的时候。 日志日志包含以下相关行: 02:09:22 systemd[1]: Starting The Apache HTTP Server… 02:09:22 systemd[1]: Starting MariaDB database server… 02:09:22 systemd[1]: Starting The PHP FastCGI Process Manager… 02:09:24 systemd[1]: Started The Apache HTTP Server. 02:09:25 mysqld_safe[713]: Logging to '/var/log/mariadb/mariadb.log'. 02:09:25 mysqld_safe[713]: Starting […]
我安装msmtp在我的centos 6,我知道它的工作正常,因为我可以使用bash命令发送电子邮件: echo -e "Subject: Test Mail\r\n\r\nThis is a test mail" |msmtp –debug –from=default -t [email protected] 那么,我正在继续让nginx也允许使用msmtp ,在我的php.ini这是我的sendmailpath: sendmail_path = "/usr/bin/msmtp -C /etc/msmtprc –logfile /var/log/msmtp.log -a gmail -t" 那么,我试着用这个发送: <?php if(mail("[email protected]","A Subject Here","Hi there,\nThis email was sent using PHP's mail function.")) print "Email successfully sent"; else print "An error occured"; ?> 但是,它一直失败,我开始认为这是因为permission因为没有写在日志中,这里是我有权限 对于msmtprc @ / […]
我试图在我的域的子目录中设置Codeigniter。 目前我只在索引页面上从Codeigniter获得一个404。 一旦想要去example.com/api/welcome/index我从nginx获得一个404。 我的nginx.conf : location /api/ { alias /var/www/api/; try_files $uri $uri/ /api/index.php =404; location ~ \.php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; fastcgi_pass backend; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } 和Codeigniter.conf : $config['base_url'] = 'https:/example.com/api/'; $config['uri_protocol'] = 'REQUEST_URI'; $config['index_page'] = '';
我试图find一种方法来gracvelly重新启动我的服务器。 我尝试sudo service php5-fpm reload && sudo service nginx reload 但是这不起作用,因为在Ubuntu 14.04上重新加载php5-fpm无法正常工作(php5-fpm实例显示为未知) 执行先前的命令后,我得到了 sudo service php5-fpm status > php5-fpm stop/waiting sudo service php5-fpm restart > stop: Unknown instance: > php5-fpm start/running, process 26042 sudo service php5-fpm restart > stop: Unknown instance: > php5-fpm start/running, process 26141 我发现重启php5-fpm的唯一方法就是运行: sudo killall php5-fpm sudo service php5-fpm start > […]
Me:一般来说nginx和FastCGI都是新手,如果这是一个很明显的老式的道歉,但是谷歌search给了我很多人推荐的随机configuration值,但没有人解释他们的决定背后的原因。 nginx worker_process和PHP-FPM worker之间有什么关系? 更多的nginx工作者意味着更多的PHP-FPM工作者,还是他们不相关? 我对这个如何在高层工作的理解是 用户请求一个网页 nginx处理请求,看到它是一个PHP页面 nginx提交给PHP-FPM PHP-FPM用现有的进程处理请求,或者产生新的请求 我不清楚PHP-FPM是否会产生一个新的subprocess,以及哪个nginx工作进程正在与之交谈。 即如果你有两个相同的Web服务器,一个worker_process = 4 ,另一个worker_process = 8 ,他们都看到相同的networkingstream量,一个服务器会创build更多的PHP-FPMsubprocess比另一个? 还是我在这里说了些蠢话,说明我错过了一个基本的概念? (如果是这样,什么?) 没有试图解决一个具体的问题 – 只是试图学习如何推理nginx和php-fpm的行为,所以我可以促成规模和性能头脑风暴/故障排除。
我试图在Windows 10上创build一个bat文件来启动后台的nginx和php-fpm。 目前我可以这样做,但命令窗口(黑色窗口)保持打开状态。 如果closures窗口,php-fpm也会被终止。 这里是我在start.bat中添加的内容 @ECHO OFF cd D:\servers\nginx-1.10.1\ echo Starting Nginx… start /B cmd /K "D:\servers\nginx-1.10.1\nginx.exe" echo Start Php-cgi… start /B cmd /K "D:\servers\php-5.6.26\php-cgi.exe -b 127.0.0.1:9000 -c D:\servers\php-5.6.26\php.ini" EXIT 这是黑色的窗口上打印的内容: Starting Nginx… Start Php-cgi… 我想让窗口自动closures,但保持进程(nginx和php-fpm)运行。
不得不自定义一个新的服务器的php-fpm池configuration,我想知道是否有可能/允许/build议有一个新的池文件,这个文件名是在原始文件后面按字母顺序排列的,只有重写初始configuration的值。 原始configuration位于/etc/php/7.0/fpm/pool.d名称为www.conf 。 看来,根据与安装相关的页面,工程师直接修改原件(保存初始值的副本)。 例如 [www] … user www-data group www-data pm.max_children 2 在修改后给出 [www] … user myapp ; was www-data group myapp ; was www-data pm.max_children 8 ; was 2 但似乎可能是下一次升级php-fpm后重复的任务(此外,configuration是在7.0path,这是令人担忧的)。 而不是修改原始文件,我想保持不变,并添加另一个,说wwwmyapp.conf将声明相同的池,只有值已经改变 在wwwmyapp.conf [www] ; same pool! user myapp group myapp pm.max_children 8 在pool.d中,文件列表 www.conf wwwmyapp.conf 因为在php-fpm.conf中加载了所有池conf文件, wwwmyapp的值将会在www (在同一个www池中)之后被读取,并且应该覆盖第一个值。 它似乎在一些testing工作,没有错误报告,但它会一直工作,并为所有的价值? 我们应该直接覆盖configuration文件吗? 在任何文档中找不到答案,即使在php.net上。