настройка nginx

Обсуждаем все, что относится к выделенным серверам *NIX (Unix, Linux) и Windows
Сообщение
Автор
Аватара пользователя
zanoza73
Капитан
Капитан
Сообщения: 299
Зарегистрирован: 02.09.2011
Откуда: Россия, Выборг
Поблагодарили: 34 раза

#1 Сообщение 22.10.2013, 18:00

Всем привет. Пробовал настраивать nginx но у меня ничего не получилось помогите пожалуйста.
вот это окно горит всё, хоть убейся. ещё вот такая ошибка есть при перезапуске php5-fpm [FAIL] Restarting PHP5 FastCGI Process Manager: php5-fpm failed!
Вложения
nginx-192.168.0.121-welcome-to-nginx.png
nginx-192.168.0.121-welcome-to-nginx.png (42.48 КБ) 1836 просмотров
nginx-192.168.0.121-welcome-to-nginx.png
nginx-192.168.0.121-welcome-to-nginx.png (42.48 КБ) 1836 просмотров
Последний раз редактировалось zanoza73 22.10.2013, 19:42, всего редактировалось 1 раз.
Изображение
ИзображениеИзображение
https://killsbot.ru Мой Проект |CS:GO|

Аватара пользователя
NiGHt-LEshiY
Полковник
Полковник
Сообщения: 10258
Зарегистрирован: 13.06.2008
Откуда: Россия
Благодарил (а): 752 раза
Поблагодарили: 2667 раз
Контактная информация:

#2 Сообщение 22.10.2013, 18:18

Покажи nginx.conf
Кодекс поведения участников сообщества — обязательно к прочтению.
Просьба присылать сообщения об ошибках в ЛС.

Аватара пользователя
zanoza73
Капитан
Капитан
Сообщения: 299
Зарегистрирован: 02.09.2011
Откуда: Россия, Выборг
Поблагодарили: 34 раза

#3 Сообщение 22.10.2013, 18:31

NiGHt-LEshiY писал(а):Покажи nginx.conf
user www-data;
worker_processes 2;
pid /run/nginx.pid;

events {
worker_connections 1024;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##

#include /etc/nginx/naxsi_core.rules;

##
# Virtual Host Configs
##

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


#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateW ... ePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
Изображение
ИзображениеИзображение
https://killsbot.ru Мой Проект |CS:GO|

Аватара пользователя
NiGHt-LEshiY
Полковник
Полковник
Сообщения: 10258
Зарегистрирован: 13.06.2008
Откуда: Россия
Благодарил (а): 752 раза
Поблагодарили: 2667 раз
Контактная информация:

#4 Сообщение 22.10.2013, 21:51

include /etc/nginx/sites-enabled/*;
Покажи тогда файлы из этой папки. Там должно быть по файлу на сайт, допустим.
Кодекс поведения участников сообщества — обязательно к прочтению.
Просьба присылать сообщения об ошибках в ЛС.

Аватара пользователя
zanoza73
Капитан
Капитан
Сообщения: 299
Зарегистрирован: 02.09.2011
Откуда: Россия, Выборг
Поблагодарили: 34 раза

#5 Сообщение 22.10.2013, 22:31

NiGHt-LEshiY писал(а):
include /etc/nginx/sites-enabled/*;
Покажи тогда файлы из этой папки. Там должно быть по файлу на сайт, допустим.
тут только default.

# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;
index index.html index.htm;

# Make site accessible from http://localhost/
server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}

# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_index index.php;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# root html;
# index index.html index.htm;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}


# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
#
# root html;
# index index.html index.htm;
#
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
#
# ssl_session_timeout 5m;
#
# ssl_protocols SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
# ssl_prefer_server_ciphers on;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
Изображение
ИзображениеИзображение
https://killsbot.ru Мой Проект |CS:GO|

Аватара пользователя
Dev
Майор
Майор
Сообщения: 601
Зарегистрирован: 07.05.2011
Откуда: Одесса
Благодарил (а): 5 раз
Поблагодарили: 48 раз
Контактная информация:

#6 Сообщение 22.10.2013, 23:40

кроме apt-get install nginx, ты еще что-то делал?:)

Аватара пользователя
zanoza73
Капитан
Капитан
Сообщения: 299
Зарегистрирован: 02.09.2011
Откуда: Россия, Выборг
Поблагодарили: 34 раза

#7 Сообщение 22.10.2013, 23:47

Dev писал(а):кроме apt-get install nginx, ты еще что-то делал?:)
делал по этому мануалу http://habrahabr.ru/post/164401/
Изображение
ИзображениеИзображение
https://killsbot.ru Мой Проект |CS:GO|

Аватара пользователя
IIIypuk
Сержант
Сержант
Сообщения: 38
Зарегистрирован: 05.01.2013
Откуда: Russia
Благодарил (а): 5 раз
Поблагодарили: 8 раз
Контактная информация:

#8 Сообщение 23.10.2013, 00:37

Попробуй перезапусти php-fpm.
Если FAIL, показывай логи php-fpm.
Лежат где-то в

Код: Выделить всё

/var/log/

Аватара пользователя
zanoza73
Капитан
Капитан
Сообщения: 299
Зарегистрирован: 02.09.2011
Откуда: Россия, Выборг
Поблагодарили: 34 раза

#9 Сообщение 23.10.2013, 08:13

IIIypuk писал(а):Попробуй перезапусти php-fpm.
Если FAIL, показывай логи php-fpm.
Лежат где-то в

Код: Выделить всё

/var/log/
[22-Oct-2013 14:25:19] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[22-Oct-2013 14:25:19] NOTICE: fpm is running, pid 5051
[22-Oct-2013 14:25:19] NOTICE: ready to handle connections
[22-Oct-2013 14:33:27] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[22-Oct-2013 14:33:27] NOTICE: Finishing ...
[22-Oct-2013 14:33:27] NOTICE: exiting, bye-bye!
[22-Oct-2013 14:33:27] NOTICE: fpm is running, pid 9179
[22-Oct-2013 14:33:27] NOTICE: ready to handle connections
[22-Oct-2013 14:33:56] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[22-Oct-2013 14:33:56] NOTICE: Finishing ...
[22-Oct-2013 14:33:56] NOTICE: exiting, bye-bye!
[22-Oct-2013 14:33:56] NOTICE: fpm is running, pid 10672
[22-Oct-2013 14:33:56] NOTICE: ready to handle connections
[22-Oct-2013 14:34:15] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[22-Oct-2013 14:57:54] NOTICE: Finishing ...
[22-Oct-2013 14:57:54] NOTICE: exiting, bye-bye!
[22-Oct-2013 14:58:39] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[22-Oct-2013 14:58:39] NOTICE: fpm is running, pid 3611
[22-Oct-2013 14:58:39] NOTICE: ready to handle connections
[22-Oct-2013 15:02:47] NOTICE: Finishing ...
[22-Oct-2013 15:02:47] NOTICE: exiting, bye-bye!
[22-Oct-2013 15:03:35] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 15:03:35] ERROR: failed to post process the configuration
[22-Oct-2013 15:03:35] ERROR: FPM initialization failed
[22-Oct-2013 16:52:52] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 16:52:52] ERROR: failed to post process the configuration
[22-Oct-2013 16:52:52] ERROR: FPM initialization failed
[22-Oct-2013 17:15:34] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 17:15:34] ERROR: failed to post process the configuration
[22-Oct-2013 17:15:34] ERROR: FPM initialization failed
[22-Oct-2013 17:15:45] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 17:15:45] ERROR: failed to post process the configuration
[22-Oct-2013 17:15:45] ERROR: FPM initialization failed
[22-Oct-2013 17:38:14] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 17:38:14] ERROR: failed to post process the configuration
[22-Oct-2013 17:38:14] ERROR: FPM initialization failed
[22-Oct-2013 17:38:14] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 17:38:14] ERROR: failed to post process the configuration
[22-Oct-2013 17:38:14] ERROR: FPM initialization failed
[22-Oct-2013 17:38:23] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 17:38:23] ERROR: failed to post process the configuration
[22-Oct-2013 17:38:23] ERROR: FPM initialization failed
[22-Oct-2013 17:38:23] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 17:38:23] ERROR: failed to post process the configuration
[22-Oct-2013 17:38:23] ERROR: FPM initialization failed
[22-Oct-2013 17:56:05] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 17:56:05] ERROR: failed to post process the configuration
[22-Oct-2013 17:56:05] ERROR: FPM initialization failed
[22-Oct-2013 17:56:05] ALERT: [pool www] no listen address have been defined!
[22-Oct-2013 17:56:05] ERROR: failed to post process the configuration
[22-Oct-2013 17:56:05] ERROR: FPM initialization failed
[22-Окт-2013 17:56:09] ALERT: [pool www] no listen address have been defined!
[22-Окт-2013 17:56:09] ERROR: failed to post process the configuration
[22-Окт-2013 17:56:09] ERROR: FPM initialization failed
[22-Окт-2013 17:56:09] ALERT: [pool www] no listen address have been defined!
[22-Окт-2013 17:56:09] ERROR: failed to post process the configuration
[22-Окт-2013 17:56:09] ERROR: FPM initialization failed
[22-Окт-2013 19:42:34] ALERT: [pool www] no listen address have been defined!
[22-Окт-2013 19:42:34] ERROR: failed to post process the configuration
[22-Окт-2013 19:42:34] ERROR: FPM initialization failed
[22-Окт-2013 22:22:42] ALERT: [pool www] no listen address have been defined!
[22-Окт-2013 22:22:42] ERROR: failed to post process the configuration
[22-Окт-2013 22:22:42] ERROR: FPM initialization failed
[23-Oct-2013 08:09:24] ALERT: [pool www] no listen address have been defined!
[23-Oct-2013 08:09:24] ERROR: failed to post process the configuration
[23-Oct-2013 08:09:24] ERROR: FPM initialization failed
Изображение
ИзображениеИзображение
https://killsbot.ru Мой Проект |CS:GO|

Аватара пользователя
IIIypuk
Сержант
Сержант
Сообщения: 38
Зарегистрирован: 05.01.2013
Откуда: Russia
Благодарил (а): 5 раз
Поблагодарили: 8 раз
Контактная информация:

#10 Сообщение 23.10.2013, 12:44

Создай файл такого содержимого

Код: Выделить всё

server {
  listen  80;
  server_name  localhost;

  charset  utf-8;

  include  ssl.conf;
  keepalive_timeout  70;

  root  /srv/http/test/;

  location / {
    index  index.html;
  }

  location ~ \.php$ {
    include fastcgi.conf;
    try_files  $uri = 404; 
    fastcgi_pass  unix:/run/php-fpm/php-fpm.sock;
    fastcgi_index  index.php;
  }

  #error_page  404 /404.html;

  error_page  500 502 503 504 /50x.html;
  location = /50x.html {
    root  /usr/share/nginx/html;
  }
}
и положи его в /etc/nginx/sites-enabled/ под любым именем.

В папке /srv/http/test/ создай файл index.php

Код: Выделить всё

<?php phpinfo(); ?>
И попробуй в браузере открыть localhost.

Nginx у тебя работает, но работает ли php-fpm я из логов не совсем понимаю :)

Аватара пользователя
zanoza73
Капитан
Капитан
Сообщения: 299
Зарегистрирован: 02.09.2011
Откуда: Россия, Выборг
Поблагодарили: 34 раза

#11 Сообщение 23.10.2013, 17:59

IIIypuk писал(а):Создай файл такого содержимого

Код: Выделить всё

server {
  listen  80;
  server_name  localhost;

  charset  utf-8;

  include  ssl.conf;
  keepalive_timeout  70;

  root  /srv/http/test/;

  location / {
    index  index.html;
  }

  location ~ \.php$ {
    include fastcgi.conf;
    try_files  $uri = 404; 
    fastcgi_pass  unix:/run/php-fpm/php-fpm.sock;
    fastcgi_index  index.php;
  }

  #error_page  404 /404.html;

  error_page  500 502 503 504 /50x.html;
  location = /50x.html {
    root  /usr/share/nginx/html;
  }
}
и положи его в /etc/nginx/sites-enabled/ под любым именем.

В папке /srv/http/test/ создай файл index.php

Код: Выделить всё

<?php phpinfo(); ?>
И попробуй в браузере открыть localhost.

Nginx у тебя работает, но работает ли php-fpm я из логов не совсем понимаю :)
ничего не изменилось.

Добавлено спустя 2 часа 58 минут 24 секунды:
IIIypuk писал(а):Создай файл такого содержимого

Код: Выделить всё

server {
  listen  80;
  server_name  localhost;

  charset  utf-8;

  include  ssl.conf;
  keepalive_timeout  70;

  root  /srv/http/test/;

  location / {
    index  index.html;
  }

  location ~ \.php$ {
    include fastcgi.conf;
    try_files  $uri = 404; 
    fastcgi_pass  unix:/run/php-fpm/php-fpm.sock;
    fastcgi_index  index.php;
  }

  #error_page  404 /404.html;

  error_page  500 502 503 504 /50x.html;
  location = /50x.html {
    root  /usr/share/nginx/html;
  }
}
и положи его в /etc/nginx/sites-enabled/ под любым именем.

В папке /srv/http/test/ создай файл index.php

Код: Выделить всё

<?php phpinfo(); ?>
И попробуй в браузере открыть localhost.

Nginx у тебя работает, но работает ли php-fpm я из логов не совсем понимаю :)
php-fpm вроде как не работает, т.к когда я ввожу /etc/init.d/php5-fpm stop , то ничего не происходит.
Изображение
ИзображениеИзображение
https://killsbot.ru Мой Проект |CS:GO|

Non_Stop
Капитан
Капитан
Сообщения: 255
Зарегистрирован: 27.07.2010
Благодарил (а): 1 раз
Поблагодарили: 28 раз
Контактная информация:

#12 Сообщение 23.10.2013, 21:10

а оно тебе нужно вообще?
Поставь Isp lite на 2 недели бесплатно,настрой что надо если руками не получается и всё,дальше уже можно спокойно по примерам делать вручную.
VDS хостинг от 1.5$. Защита от DDOS. Частота CPU от 3.5 МГЦ
Идеальное предложение для игрового сервера. Хостинг VDS

Аватара пользователя
zanoza73
Капитан
Капитан
Сообщения: 299
Зарегистрирован: 02.09.2011
Откуда: Россия, Выборг
Поблагодарили: 34 раза

#13 Сообщение 23.10.2013, 21:24

Non_Stop писал(а):а оно тебе нужно вообще?
Поставь Isp lite на 2 недели бесплатно,настрой что надо если руками не получается и всё,дальше уже можно спокойно по примерам делать вручную.
нужно просто настроить не получается(((
а сайт, сб и стату и т.д. я на твой Isp lite ставить?
Изображение
ИзображениеИзображение
https://killsbot.ru Мой Проект |CS:GO|

bir3yk
Полковник
Полковник
Сообщения: 1346
Зарегистрирован: 07.09.2009
Поблагодарили: 26 раз

#14 Сообщение 25.10.2013, 12:35

в /etc/php5/fpm/pool.d/www.conf
смотрите значение listen

2 варианта:
1)
nginx(default или свой какой то)
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
php-fpm(www.conf)
тогда listen = /var/run/php-fpm/php-fpm.sock;

2)
nginx
fastcgi_pass 127.0.0.1:9000;
php-fpm
тогда listen = 127.0.0.1:9000;
Изображение

Аватара пользователя
zanoza73
Капитан
Капитан
Сообщения: 299
Зарегистрирован: 02.09.2011
Откуда: Россия, Выборг
Поблагодарили: 34 раза

#15 Сообщение 25.10.2013, 16:13

bir3yk писал(а):в /etc/php5/fpm/pool.d/www.conf
смотрите значение listen

2 варианта:
1)
nginx(default или свой какой то)
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
php-fpm(http://www.conf)
тогда listen = /var/run/php-fpm/php-fpm.sock;

2)
nginx
fastcgi_pass 127.0.0.1:9000;
php-fpm
тогда listen = 127.0.0.1:9000;
вроде всё есть. только ничего не работает
Изображение
ИзображениеИзображение
https://killsbot.ru Мой Проект |CS:GO|

Ответить Вложения 1