LinuxForum.Fans
Тема

Apache 2 + nginx

Автор: ERT 24 сообщений 6328 просмотров
#201510

Снес пока что nginx, оставил один apache. Интересно, откуда в error.log вот эти ошибки и уведомления:

Показать
text
[Fri Oct 28 17:53:19 2011] [error] [client 66.249.72.52] File does not exist: /var/www/evolutiongame.com.ua/stats
[Fri Oct 28 17:53:20 2011] [notice] caught SIGTERM, shutting down
[Fri Oct 28 17:56:03 2011] [error] [client 192.168.0.2] File does not exist: /var/www/evolutiongame.com.ua/clientscript/mgc_cb_evo, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:10 2011] [error] [client 46.30.167.217] File does not exist: /var/www/evolutiongame.com.ua/clientscript/mgc_cb_evo, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:12 2011] [error] [client 46.30.167.217] File does not exist: /var/www/evolutiongame.com.ua/clientscript/mgc_cb_evo, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:32 2011] [error] [client 192.168.0.2] File does not exist: /var/www/evolutiongame.com.ua/clientscript/mgc_cb_evo, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:37 2011] [error] [client 46.30.167.217] File does not exist: /var/www/evolutiongame.com.ua/images/misc/mgc_cb_evo/channels/adm_new.gif, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:37 2011] [error] [client 46.30.167.217] File does not exist: /var/www/evolutiongame.com.ua/images/buttons/collapse_alt_collapsed.gif, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Undefined index: lang in /var/www/evolutiongame.com.ua/bans/include/config.inc.php on line 62, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  A session had already been started - ignoring session_start() in /var/www/evolutiongame.com.ua/bans/include/access.inc.php on line 23, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Undefined index: loggedin in /var/www/evolutiongame.com.ua/bans/include/access.inc.php on line 34, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_COUNTRY_EDITION already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 173, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_PROXY_EDITION already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 174, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_ASNUM_EDITION already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 175, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_NETSPEED_EDITION already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 176, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_REGION_EDITION_REV0 already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 177, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_REGION_EDITION_REV1 already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 178, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_CITY_EDITION_REV0 already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 179, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_CITY_EDITION_REV1 already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 180, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_ORG_EDITION already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 181, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_UNKNOWN_SPEED already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 192, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_DIALUP_SPEED already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 193, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_CABLEDSL_SPEED already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 194, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Constant GEOIP_CORPORATE_SPEED already defined in /var/www/evolutiongame.com.ua/bans/include/geoip.inc on line 195, referer: http://evolutiongame.com.ua/forum.php
[Fri Oct 28 17:56:38 2011] [error] [client 46.30.167.217] PHP Notice:  Undefined variable: page in /var/www/evolutiongame.com.ua/bans/ban_list.php on line 58, referer: http://evolutiongame.com.ua/forum.php

Интересует вот эти уведомления - PHP Notice: Constant GEOIP_CITY_EDITION_REV1 already defined.
А вот этой директории на сервере нет вообще (была раньше, а теперь нет): File does not exist: /var/www/evolutiongame.com.ua/stats

#202649

Получаю ошибку 502 Bad Gateway, когда пытаюсь подключить в конфиге хоста nginx php5-fpm.

text
    upstream fpm {
        server unix:/var/run/php-fpm.sock;
    }        
location ~ \.php$ {
            fastcgi_pass fpm;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
            include        fastcgi_params;                      
        }

Причем, если набрать в браузере http://mysite.com.ua - все ок, а если ссылка принимает вид http://mysite.com.ua/index.php - BadGataway.
Использую Apache + Nginx.

#202667

ERT, сложно так сказать, надо всю картину видеть, часто nginx дает 502 из-за неправильных рерайтов.
И тут я не пойму чего ты хочешь добиться, подключив php-fpm тк работаешь в паре с apache.
Или это второй виртуалхост?
Тогда выкладывай целиком конфиг mginx.
Да, зачем upstream?
Вот простейший вариант php-fpm:

text
location ~ \.php$ {
        fastcgi_pass   unix:/tmp/php-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www$fastcgi_script_name;
        include fastcgi_params;
    }
#202782
newzenon написал:
И тут я не пойму чего ты хочешь добиться, подключив php-fpm тк работаешь в паре с apache.

Возможно отказаться от этой связки и перейти только на nginx.
Вот конфиги.
nginx.conf:

Показать
text
user www-data;
worker_processes  4;

timer_resolution 100ms; worker_rlimit_nofile 8192; worker_priority -5;

error_log /var/log/nginx/error.log; pid /var/run/nginx.pid;

events { worker_connections 1024; }

http { include /etc/nginx/mime.types; default_type application/octet-stream; server_names_hash_bucket_size 64; access_log /var/log/nginx/access.log;

sendfile on; #tcp_nopush on; client_max_body_size 900m;

#keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on;

gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_proxied any; gzip_min_length 1100; gzip_http_version 1.0; gzip_buffers 4 8k; gzip_comp_level 9; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_vary on;

include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; include /etc/nginx/fastcgi_params; include /etc/nginx/proxy_params; }

Конфиги виртуальных хостов site1.com:

Показать
text
server {
listen 80;
server_name site1.com;
access_log /var/log/nginx/site1.com/access_log.log;
location ~* \.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)$ {
root /var/www/site1.com/;
index index.html index.php;
access_log off;
expires 30d;
}
location ~ /\.ht {
deny all;
}
location / {
proxy_pass http://127.0.0.1:81/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_set_header Host $host;
proxy_connect_timeout 60;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_redirect off;
proxy_set_header Connection close;
proxy_pass_header Content-Type;
proxy_pass_header Content-Disposition;
proxy_pass_header Content-Length;
}
}

site2.com с subdomain:

Показать
text
server {
listen 80;
server_name site2.com *.site2.com;
access_log /var/log/nginx/site2.com/access_log.log;
location ~* \.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)$ {
root /var/www/site2.com/$subdomain;
    set $subdomain "";
    if ($host ~* ^([a-z0-9-\.]+)\.site2.com$) {
        set $subdomain $1;
    }
    if ($host ~* ^www.site2.com$) {
        set $subdomain "";
    }
index index.html index.php;
access_log off;
expires 30d;
}
location ~ /\.ht {
deny all;
}
location / {
proxy_pass http://127.0.0.1:81/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_set_header Host $host;
proxy_connect_timeout 60;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_redirect off;
proxy_set_header Connection close;
proxy_pass_header Content-Type;
proxy_pass_header Content-Disposition;
proxy_pass_header Content-Length;
}
}

Все остальные дефолтные.

Войдите или зарегистрируйтесь, чтобы ответить.