установка nginx + PHP5 + phpDaemon и настройка виртуальных хостов на nginx на Ubuntu 13.10
https://serverfault.com/questions/361499/nginx-not-serving-requests-to-external-ip-address
sudo -s
установка nginx:
apt-get update
apt-get install nginx
https://www.digitalocean.com/community/questions/how-to-create-subdomain-with-nginx-server-in-the-same-droplet
php:
apt-get install php5
виртуальные хосты:
http://linux-bsd.in.ua/nginx/163-ubuntu-nginx-virtual-hosts.html
http://linux-bsd.in.ua/nginx/170-ubuntu-nginx-virtualnye-xosty-chast-2.html
/etc/nginx/sites-available/domain1.com
server {
listen 80;
server_name www.domain1.com;
rewrite ^/(.*) http://domain1.com/$1 permanent;
}
server {
listen 80;
server_name domain1.com;
access_log /home/demo/public_html/domain1.com/log/access.log;
error_log /home/demo/public_html/domain1.com/log/error.log;
location / {
root /home/demo/public_html/domain1.com/public/;
index index.html;
}
}
ln -s /etc/nginx/sites-available/domain1.com /etc/nginx/sites-enabled/domain1.com
/etc/init.d/nginx stop
/etc/init.d/nginx start
phpdaemon:
https://github.com/kakserpom/phpdaemon/wiki/Installation-Ubuntu-13.04
чтобы запустить service phpd start надо: sudo chmod +x /etc/init.d/phpd
sudo -s
установка nginx:
apt-get update
apt-get install nginx
https://www.digitalocean.com/community/questions/how-to-create-subdomain-with-nginx-server-in-the-same-droplet
php:
apt-get install php5
виртуальные хосты:
http://linux-bsd.in.ua/nginx/163-ubuntu-nginx-virtual-hosts.html
http://linux-bsd.in.ua/nginx/170-ubuntu-nginx-virtualnye-xosty-chast-2.html
/etc/nginx/sites-available/domain1.com
server {
listen 80;
server_name www.domain1.com;
rewrite ^/(.*) http://domain1.com/$1 permanent;
}
server {
listen 80;
server_name domain1.com;
access_log /home/demo/public_html/domain1.com/log/access.log;
error_log /home/demo/public_html/domain1.com/log/error.log;
location / {
root /home/demo/public_html/domain1.com/public/;
index index.html;
}
}
ln -s /etc/nginx/sites-available/domain1.com /etc/nginx/sites-enabled/domain1.com
/etc/init.d/nginx stop
/etc/init.d/nginx start
phpdaemon:
https://github.com/kakserpom/phpdaemon/wiki/Installation-Ubuntu-13.04
Installation of phpdaemon on Ubuntu 13.04 is relatively easy.
- Install php5:
sudo apt-get -V install php5
- Install development tools (gcc, make, etc):
sudo apt-get -V install build-essential php5-dev php-pear git libevent-dev
- Install php5 libraries (using pecl):
sudo apt-get -V install php-pear
sudo pecl install http://pecl.php.net/get/eio-1.2.1.tgz
(just hit enter for the single question)sudo pecl install http://pecl.php.net/get/event-1.6.0.tgz
(answer "no" to "Include libevent OpenSSL support [yes] :"; enter for the other questions) - Add the new php extensions to the php5 config:
Create two new files in the /etc/php5/mods-available directory.sudo touch /etc/php5/mods-available/eio.ini
echo "; priority=20" | sudo tee -a /etc/php5/mods-available/eio.ini
echo "extension=eio.so" | sudo tee -a /etc/php5/mods-available/eio.ini
sudo touch /etc/php5/mods-available/event.ini
echo "; priority=20" | sudo tee -a /etc/php5/mods-available/event.ini
echo "extension=event.so" | sudo tee -a /etc/php5/mods-available/event.ini
sudo php5enmod eio event
- Make a directory to hold the phpdaemon files:
sudo mkdir /opt/phpdaemon
- Make your user the owner of the phpdaemon direcotry (replace with your actual user and group names):
sudo chown [your user]:[your group] /opt/phpdaemon
- Copy the phpdaemon files from GitHub:
git clone https://github.com/kakserpom/phpdaemon.git /opt/phpdaemon
- Copy the Ubuntu init script:
sudo cp /opt/phpdaemon/init-scripts/phpd.ubuntu /etc/init.d/phpd
- Create a basic config file (using the template):
cp /opt/phpdaemon/conf/phpd.conf.example /opt/phpdaemon/conf/phpd.conf
- Create directory to hold logs and the pid file:
mkdir /opt/phpdaemon/{run,log}
- Modify the config file to set the pidfile and log file locations: Add two lines to the /opt/phpdaemon/conf/phpd.conf file (after the line that says "max-idle 0;"
pidfile '/opt/phpdaemon/run/phpd.pid';
logstorage '/opt/phpdaemon/log/phpdaemon.log';
- Start it up!
service phpd start
(as long as you do not try to bind to a port under 1024 you can start/stop phpd as a regular user) - Check the log file for any errors:
tail -n 150 /opt/phpdaemon/log/phpdaemon.log
чтобы запустить service phpd start надо: sudo chmod +x /etc/init.d/phpd
после этого будет ошибка php, надо:
sudo gedit /etc/php5/cli/php.ini
comment this line disable_functions = ...
Комментарии
Отправить комментарий