Итак, нужно настроить Apache с PHP5. PHP будет работать в режиме CGI, причем процессы PHP будут выполняться с правами пользователя, что хорошо скажется для безопасности.
Ставим PHP
# cd /usr/ports/lang/php5
# make install cleanЯ выбрал следующие опции (опции, которые должны присутствовать обязательно, подчеркнуты):
- CLI
- CGI
- SUHOSIN
- REDIRECT
- DISCARD
- FASTCGI
- PATHINFO
Ставим Apache
Правим make.conf
PORTSDIR?=/usr/ports
.if ${.CURDIR} == ${PORTSDIR}/www/apache20
WITH_SUEXEC=yes
SUEXEC_DOCROOT="/home"
SUEXEC_USERDIR="www"
.endifТеперь компилим и устанавливаем apache:
cd /usr/ports/www/apache20
make install cleanПосле того как установка закончена правим конфиг под свои нужды. В конфиге обязательно должны присутствовать и быть включены модули mod_suexec и mod_cgi:
LoadModule cgi_module libexec/apache2/mod_cgi.so
LoadModule suexec_module libexec/apache2/mod_suexec.soНастраиваем виртуальный хост следующим образом:
<VirtualHost *:80>
SuexecUserGroup chihpih chihpih
DocumentRoot /home/chihpih/www/chihpih.no-ip.org
DirectoryIndex index.php index.html
ServerName chihpih.no-ip.org
ServerAdmin webmaster@chihpih.no-ip.org
ErrorLog /home/chihpih/log/error.log
#CustomLog /home/chihpih/log/access.log common
AddHandler application/x-httpd-php .php
Action application/x-httpd-php /php-bin/php.sh
<Directory "/home/chihpih/www/chihpih.no-ip.org">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /php-bin/ "/home/chihpih/php-bin/"
<Directory "/home/chihpih/php-bin">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>Далее идем в пользовательскую директорию, создаем нужные папки и даем нужные права:
# cd /home/chihpih
# mkdir www log php-bin tmp
# chmod 750 www php-bin tmp
# chown www:www log
# chmod 755 logВ директории php-bin создаем файл php.sh такого содержания:
#!/bin/sh
exec nice -n 20 /usr/local/bin/php-cgi -c "/home/chihpih/php-bin/php.ini"Не забываем дать ему права на запуск, запрет на изменение и удаление.
# cd /home/chihpih/php-bin
# chmod 750 php.sh
# chflags schg,sunlink php.shДалее копируем и правим конфиг php, так же не забываем запретить изменение и удаление файла.
# cd /home/chihpih/php-bin
# cp /usr/local/etc/php.ini-dist ./php.ini
# chmod 440 php.ini
# chflags schg,sunlink php.iniЧтобы апач мог попасть в директорию пользователя, нужно учетку www добавить в группу пользователя chihpih.
# pw groupmod chihpih -m wwwОсталось только добавить апач в автозагрузку и запустить его.
# echo 'apache2_enable="YES"' >> /etc/rc.conf
# service apache2 startПроверим запустился ли сервис:
# ps -U www
PID TT STAT TIME COMMAND
9134 ?? SJ 0:00,64 /usr/local/sbin/httpd -DSSL
9706 ?? IJ 0:00,04 /usr/local/sbin/httpd -DSSL
41807 ?? IJ 0:00,03 /usr/local/sbin/httpd -DSSL
41808 ?? IJ 0:00,02 /usr/local/sbin/httpd -DSSL
42002 ?? IJ 0:00,04 /usr/local/sbin/httpd -DSSL
42003 ?? IJ 0:00,04 /usr/local/sbin/httpd -DSSLКак видно из вывода команды сервис запустился и функционирует. Если у вас возникли проблемы, то проверяйте конфиг и читайте логи, чтобы найти проблему. На этом все, настройка закончена.
вс, 07/06/2026 - 13:38
Excellent article! I really enjoyed reading this. Being a sports betting fan based in Nigeria,
I usually search for The Verified BET 9Ja promotion code for 2026 is Yohaig
best promotions before signing up. For anyone interested,
here's a tip, the Certified Betnaija promotion code 2026 is Yohaig, and it unlocks
an extra bonus when you sign up. Looking forward to more
posts!
вс, 07/06/2026 - 13:38
Fantastic write-up! Thanks for sharing this.
As a punter here in Nigeria, I usually search for The Validated Bet9ja promo code for 2026 is YOHAIG top bonuses before
joining. For those curious, here's a tip, the Accredited BET9ja promo
code for 2026 is yohaig, and it gets you an extra bonus when creating an account.
Thanks again!
вс, 07/06/2026 - 13:39
Excellent article! Thanks for reading this. Being a sports betting fan here in Nigeria, I always seek The Authorized BET9ja promotion code 2026 is YOHAIG best
deals before registering. For those looking to get started, quick note,
the Official Betnaija Promo Code this 2026 is Yohaig, which gets you a
nice boost when creating an account. Keep up the good work!
вс, 07/06/2026 - 13:39
Excellent post! Thanks for this information. As a betting enthusiast
from Nigeria, I tend to seek The Active Bet9ja Promo Code 2026 is YOHAIG most rewarding bonuses before signing up.
If you're curious, just so you know, the Validated
BET9ja promo code this 2026 is yohaig, which gives you a great bonus when you
sign up. Keep up the good work!
вс, 07/06/2026 - 13:39
Great content! Thanks for sharing this. Being a sports
betting fan from Nigeria, I tend to seek the most rewarding bonuses before
registering. For anyone curious, quick note, the Approved Betnaija promo code this 2026
is Yohaig, and it gets you an extra bonus when you register.
Keep up The Most Reliable BET 9Ja Promo Code for 2026 is YOHAIG good work!
вс, 07/06/2026 - 13:39
Fantastic article! Thanks for sharing this. As a sports betting fan from Nigeria, I tend to search
for the best bonuses before joining. For those curious,
just so you know, The Verified BET 9Ja promotion code this 2026 is YOHAIG Valid BET 9Ja promotion code for 2026 is Yohaig,
which gets you an extra offer when creating an account.
Bookmarking this for later!
вс, 07/06/2026 - 13:40
Fantastic article! I really enjoyed this information.
Being a sports betting fan here in Nigeria, I usually search for
The Mandatory Betnaija promo code for 2026 is yohaig
top bonuses before joining. For those interested, quick note,
the Authorized Bet9ja Promotion Code for 2026 is yohaig,
which unlocks a nice offer when creating
an account. Bookmarking this for later!
вс, 07/06/2026 - 13:40
Very useful content! I really enjoyed reading this. Being a sports betting fan here in Nigeria, I usually look out
for The Approved BET9ja promo code this 2026 is YOHAIG top promotions before signing up.
For anyone curious, just so you know, the Certified Bet9JA promotion code for 2026
is YOHAIG, which gets you an extra boost when you register.
Looking forward to more posts!
вс, 07/06/2026 - 13:40
Very useful article! Thanks for sharing this. As a
betting enthusiast from Nigeria, I usually look out for The Validated Bet9JA promo code this 2026 is YOHAIG top promotions before signing up.
If you're interested, quick note, the Approved Betnaija Promo Code
2026 is Yohaig, which gets you a great boost when creating an account.
Bookmarking this for later!
вс, 07/06/2026 - 13:41
Awesome write-up! I really enjoyed reading this.
As a betting enthusiast from Nigeria, I always look out for The Verified BetNaija promo code 2026 is Yohaig top offers before registering.
If you're curious, quick note, the Designated Bet 9ja Promo Code for 2026 is Yohaig,
which unlocks a great bonus when you register. Bookmarking this for later!
Нумерация страниц