Table of Contents |
---|
Установка
FreeBSD 11.x
Code Block language bash # устанавливаем nginx из портов cd /usr/ports/www/nginx make && make install && make clean # проверяем nginx -v # если до этого не использовался Apache, генерируем сертификаты /usr/abills/misc/certs_create.sh apache # автозагрузка echo 'nginx_enable="YES"' >> /etc/rc.conf # устанавливаем Fast CGI wrapper pkg install p5-FCGI pkg install p5-IO-All pkg install fcgiwrap # настройки для fcgi echo 'fcgiwrap_enable="YES"' >> /etc/rc.conf echo 'fcgiwrap_user="www"' >> /etc/rc.conf echo 'fcgiwrap_socket_owner="www"' >> /etc/rc.conf
Ubuntu 16.04/18.04, Debian 9
Code Block language bash # устанавливаем nginx, fcgi apt-get install fcgiwrap nginx # проверяем nginx -v # если до этого не использовался Apache, генерируем сертификаты /usr/abills/misc/certs_create.sh apache # автозагрузка update-rc.d nginx defaults update-rc.d fcgiwrap defaults
CentOS 7
Code Block language bash # устанавливаем nginx, fcgi yum install fcgiwrap nginx # проверяем nginx -v # если до этого не использовался Apache, генерируем сертификаты /usr/abills/misc/certs_create.sh apache # автозагрузка chkconfig nginx on # устанавливаем Fast CGI yum -y install fcgi-devel cd /usr/local/src/ git clone git://github.com/gnosek/fcgiwrap.git cd fcgiwrap autoreconf -i ./configure make && make install yum -y install spawn-fcgi usermod -a -G apache nginx chkconfig spawn-fcgi on
Конфигурационный файл nginx, etc
Warning title ВАЖНО ! Внимательно проверьте для своей ОС следующие опции в конфигурационном файле :
user www www; # freebsd
user www-data www-data; # ubuntu /debian
user apache apache; # centos
fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock; # freebsd
fastcgi_pass unix:/var/run/fcgiwrap.socket; # ubuntu / debian / centos
FreeBSD
Code Block language bash title /usr/local/etc/nginx/nginx.conf collapse true user www www; pid /var/run/nginx.pid; worker_processes 2; # = CPU cores count events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 9443 ssl; server_name billing.abillz.net; # = DNS name or IP if no DNS record exist root /usr/abills/cgi-bin; index index.cgi; charset utf-8; access_log /var/log/abills-access.log; error_log /var/log/abills-error.log; ssl_certificate /usr/abills/Certs/server.crt; ssl_certificate_key /usr/abills/Certs/server.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL; ssl_prefer_server_ciphers off; location / { try_files $uri $uri /index.cgi; } location /admin { try_files $uri $uri /admin/index.cgi; } location ^~ /images/ { alias /usr/abills/Abills/templates/; location ~* \.(jpg|gif|png|css|js|JPG|GIF)$ { allow all; } deny all; } location ~ \.cgi|pm|pl$ { gzip off; fastcgi_param HTTPS on; fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock; fastcgi_index index.cgi; fastcgi_param HTTP_CGI_AUTHORIZATION $http_authorization; fastcgi_param SCRIPT_FILENAME /usr/abills/cgi-bin$fastcgi_script_name; include fastcgi_params; } } }
Debian / Ubuntu
Code Block language bash title /etc/nginx/nginx.conf collapse true user www-data www-data; pid /var/run/nginx.pid; worker_processes 2; # = CPU cores count events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 9443 ssl; server_name billing.abillz.net; # = DNS name or IP if no DNS record exist root /usr/abills/cgi-bin; index index.cgi; charset utf-8; access_log /var/log/abills-access.log; error_log /var/log/abills-error.log; ssl_certificate /usr/abills/Certs/server.crt; ssl_certificate_key /usr/abills/Certs/server.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL; ssl_prefer_server_ciphers off; location / { try_files $uri $uri /index.cgi; } location /admin { try_files $uri $uri /admin/index.cgi; } location ^~ /images/ { alias /usr/abills/Abills/templates/; location ~* \.(jpg|gif|png|css|js|JPG|GIF)$ { allow all; } deny all; } location ~ \.cgi|pm|pl$ { gzip off; fastcgi_param HTTPS on; fastcgi_pass unix:/var/run/fcgiwrap.socket; fastcgi_index index.cgi; fastcgi_param HTTP_CGI_AUTHORIZATION $http_authorization; fastcgi_param SCRIPT_FILENAME /usr/abills/cgi-bin$fastcgi_script_name; include fastcgi_params; } } }
CentOS
Code Block language bash title /etc/nginx/nginx.conf collapse true user apache apache; pid /var/run/nginx.pid; worker_processes 2; # = CPU cores count events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 9443 ssl; server_name billing.abillz.net; # = DNS name or IP if no DNS record exist root /usr/abills/cgi-bin; index index.cgi; charset utf-8; access_log /var/log/abills-access.log; error_log /var/log/abills-error.log; ssl_certificate /usr/abills/Certs/server.crt; ssl_certificate_key /usr/abills/Certs/server.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL; ssl_prefer_server_ciphers off; location / { try_files $uri $uri /index.cgi; } location /admin { try_files $uri $uri /admin/index.cgi; } location ^~ /images/ { alias /usr/abills/Abills/templates/; location ~* \.(jpg|gif|png|css|js|JPG|GIF)$ { allow all; } deny all; } location ~ \.cgi|pm|pl$ { gzip off; fastcgi_param HTTPS on; fastcgi_pass unix:/var/run/fcgiwrap.socket; fastcgi_index index.cgi; fastcgi_param HTTP_CGI_AUTHORIZATION $http_authorization; fastcgi_param SCRIPT_FILENAME /usr/abills/cgi-bin$fastcgi_script_name; include fastcgi_params; } } }
Code Block language bash title /etc/sysconfig/spawn-fcgi collapse true FCGI_SOCKET=/var/run/fcgiwrap.socket FCGI_PROGRAM=/usr/local/sbin/fcgiwrap FCGI_USER=apache FCGI_GROUP=apache FCGI_EXTRA_OPTIONS="-M 0770" OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- $FCGI_PROGRAM"
Запускаем сервисы, проверяем :
FreeBSD / Ubuntu / Debian
Code Block language bash service nginx start service fcgiwrap start
CentOS
Code Block language bash systemctl start nginx systemctl start spawn-fcgi
Открываем в браузере :https://your_domain_or_IP:9443/admin/index.cgi
Проверяем все ли работает нормально.