Welcome! Log In Create A New Profile

Advanced

ПОдскажите nginx+apache2 + mod-php fcgi

March 10, 2012 09:07AM
Заранее спасибо вам. Уже 2 день не получается заставить работать все как надо. Привожу конфиги различные.

Значит использую я вот этот ман:[code]http://www.bubuntu.spb.ru/nginx-apache-ssl-https/[/code]

nano /etc/apache2/ports.conf
[spoiler]# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:8080
Listen 127.0.0.1:8080

<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>
[/spoiler]

/etc/apache2/sites-available/bubuntu.spb.ru.conf
[spoiler]<VirtualHost *>
DocumentRoot "/var/www/bubuntu"
ServerName bubuntu.spb.ru
<Directory "/var/www/bubuntu">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
[/spoiler]

все что касается ssl в мане, я делать не стал.
далее по нему же
[code]sudo a2ensite bubuntu.spb.ru[/code]
ответом мне было: ERROR: Site bubuntu.spb.ru does not exist!
Я подключил хост через ln -s /блаблабла... тоесть поставил символическую ссылку в sites-enabled

далее:/etc/nginx/nginx.conf
[spoiler]user www-data;

# Число рабочих процессов, рекомендуется ставить по количеству ядер
worker_processes 1;

# Уменьшает число системных вызовов gettimeofday(), что приводит к увеличению производительности
timer_resolution 100ms;

# Изменяет ограничение на число используемых файлов RLIMIT_NOFILE для рабочего процесса.
worker_rlimit_nofile 8192;

# Директива задаёт приоритет рабочих процессов от -20 до 20 (отрицательное число означает более высокий приоритет).
worker_priority -5;

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

pid /var/run/nginx.pid;

events {
worker_connections 2048;
# use kqueue; для freebsd (рекомендация от psihoz)
use epoll;
}

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

log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

# Включить sendfile(). Использование sendfile() экономит системные вызовы, уменьшает число копирований данных,
# позволяет использовать меньше физической памяти.
sendfile on;
keepalive_timeout 65;

gzip on;
gzip_min_length 1100;
gzip_buffers 64 8k;
gzip_comp_level 3;
gzip_http_version 1.1;
gzip_proxied any;
#gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;
}[/spoiler]

/etc/nginx/proxy.conf
[spoiler]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;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;[/spoiler]

/etc/nginx/sites-available/bubuntu.spb.ru
[spoiler]upstream bubuntu.spb.ru {
# Адрес back-end'a
server localhost:8080;
}

server {
listen 80;
server_name bubuntu.spb.ru www.bubuntu.spb.ru;
include /etc/nginx/proxy.conf;

access_log /var/log/nginx/bubuntu.spb.ru/nginx_access.log;
error_log /var/log/nginx/bubuntu.spb.ru/nginx_error.log;

#
location / {
root /var/www/bubuntu;
index index.php index.html index.htm;
}

error_page 404 /404.php;

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

# htaccess и htpasswd не отдаем
location ~ /\.ht {
deny all;
}

location ~ .php$ {
proxy_pass http://bubuntu.spb.ru;
}

location ~ /$ {
proxy_pass http://bubuntu.spb.ru;
}
}[/spoiler]

прошу обратить внимание на:
[code]#gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;[/code]
в мане она не закоментирована, у меня апач говорил что то про дублирование text/html, закоментировал все норм.

ну и подключил хост сиволической ссылкой.

в итоге:
директория /var/www/bubuntu
там лежит index.html (в нем test) и index.php (с phpinfo)

фалй hosts
[spoiler]127.0.0.1 localhost.localdomain localhost HP-625
127.0.1.1 HP-625

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 bubuntu.spd.ru
127.0.0.1 www.bubuntu.spd.ru[/spoiler]

в итоге:
ввожу http://www.bubuntu.spb.ru/ кидает на истенный сайт.
ввожу localhost/www.bubuntu.spb.ru/ нет соеденения
ввожу http://localhost:8080/ показыввает test (содержимое index.html)
ввожу http://localhost:8080/index.php показывает информацию о php
ввожу localhost:80 ни какой реакции.
ввожу http://bubuntu.spb.ru/index.html nginx показывает мне 404


подскажите, где я накосячил с хостами?? МОжет ли это быть из за домашней деректории var/www/bubuntu и соответствующих прав на нее?
Subject Author Posted

ПОдскажите nginx+apache2 + mod-php fcgi

z-0091 March 10, 2012 09:07AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 327
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready