Welcome! Log In Create A New Profile

Advanced

Re: FreeBSD & nginx

November 23, 2010 08:31AM
Не хочет заводиться nginx:


[code]
fun# /usr/local/etc/rc.d/nginx start
Performing sanity check on nginx configuration:
[emerg]: "if" directive is not allowed here in /usr/local/etc/nginx/sites-enabled/www:13
configuration file /usr/local/etc/nginx/nginx.conf test failed
Starting nginx.
[emerg]: "if" directive is not allowed here in /usr/local/etc/nginx/sites-enabled/www:13
/usr/local/etc/rc.d/nginx: WARNING: failed to start nginx
[/code]

[b]При nginx.conf[/b]
[code]
fun# cat nginx.conf

user www;
worker_processes 1;

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

events {
worker_connections 1024;
use kqueue;
}

http {
include mime.types;
default_type application/octet-stream;
include /usr/local/etc/nginx/sites-enabled/www;


# log options
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';

# nginx options
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_tokens off;

# fastcgi
fastcgi_intercept_errors on;

# virtual server
server {
listen 80;
server_name fun.viks.net.ua;

access_log /var/log/nginx.fun.viks.net.ua.log main;

# server root directory
location / {
root /www/;
index index.php index.html index.htm;
if (!-e $request_filename ) {
rewrite ^(.*)$ /index.php?q=$1;
}
}

# php
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/$fastcgi_script_name;
include fastcgi_params;
}

# phpMyAdmin
location ~ ^/phpmyadmin/(.*\.php)$ {
fastcgi_pass unix:/tmp/php-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/local/www/phpMyAdmin/$1;
fastcgi_param DOCUMENT_ROOT /usr/local/www/phpMyAdmin;
}

location /phpmyadmin {
alias /usr/local/www/phpMyAdmin/;
index index.php;

# authorization
auth_basic "Authorization Required";
auth_basic_user_file /usr/local/www/phpMyAdmin/.htpasswd;
}

sendfile on;
#tcp_nopush on;
client_max_body_size 100M;
}
}

[/code]

[b]И sites-enabled/www[/b]

[code]
fun# cat www
server {
listen fun.viks.net.ua:80;
server_name www.fun.viks.net.ua;
rewrite ^(.*) http://fun.viks.net.ua$1 permanent;
}

access_log /var/log/nginx/drupal-cgm.access.log;
error_log /var/log/nginx/drupal-cgm.error.log;

root /www;

# restrict request methods to: GET|HEAD|POST
if ( $request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
break;
}

# hide drupal system files
location ~*
((cron\.php|settings\.php)|\.(htaccess|engine|inc|info|install|module|profile|pl|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(Entries.*|Repository|Root|Tag|Template))$
{
deny all;
}

# # rewrite domain name without the leading www.
# if ($host ~* ^www\.(.*)) {
# set $host_without_www $1;
# # bellow $1 contains '/foo', not 'www.mydomain.com/foo'
# rewrite ^(.*)$ http://$host_without_www$1 permanent;
# }

location / {
index index.php index.html;
try_files $uri $uri/ @www;
}

location @www {
# clean url rewrite for Drupal
rewrite ^/(.*)$ /index.php?q=$1 last;
#rewrite ^/(\w*)/(.*)$ /$1/index.php?q=$2 last;
}

location ~ \.php$ {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

[/code]
Subject Author Posted

FreeBSD & nginx

KaMaToZzz November 23, 2010 07:20AM

Re: FreeBSD & nginx

Alexander Petrovsky November 23, 2010 07:28AM

Re: FreeBSD & nginx

Sergey Shepelev November 23, 2010 07:30AM

Re: FreeBSD & nginx

KaMaToZzz November 23, 2010 07:39AM

Re: FreeBSD & nginx

KaMaToZzz November 23, 2010 07:58AM

Re: FreeBSD & nginx

Дмитрий Андреев November 23, 2010 07:46AM

Re: FreeBSD & nginx

Sergey Shepelev November 23, 2010 07:46AM

Re: FreeBSD & nginx

KaMaToZzz November 23, 2010 08:31AM

Re: FreeBSD & nginx

KaMaToZzz November 23, 2010 08:48AM

Re: FreeBSD & nginx

KaMaToZzz November 23, 2010 08:58AM

Re: FreeBSD & nginx

Anton Yuzhaninov November 23, 2010 08:38AM

Re: FreeBSD & nginx

Sergey Shepelev November 23, 2010 08:38AM

Re: FreeBSD & nginx

DeD MustDIE November 23, 2010 09:08AM

Re: FreeBSD & nginx

Anton Gorlov November 23, 2010 09:32AM

Re: FreeBSD & nginx

KaMaToZzz November 23, 2010 09:48AM

Re: FreeBSD & nginx

Sergey Averyanov November 23, 2010 09:54AM

Re: FreeBSD & nginx

Sergey Shepelev November 23, 2010 10:08AM

Re: FreeBSD & nginx

KaMaToZzz November 23, 2010 10:27AM

Re: FreeBSD & nginx

Валентин Бартенев November 23, 2010 11:08AM

Re: FreeBSD & nginx

KaMaToZzz November 25, 2010 02:21AM

Re: FreeBSD & nginx

xpahos@gmail.com November 25, 2010 04:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 55
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready