September
29th,
2016
Nginx
Nginx
安装相当简单。
sudo apt-get install nginx
如果你想升级到最新版本,首先要添加最新的源
编辑/etc/apt/sources.list
,添加最新的官方源
deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx
运行apt-get update
,而后install nginx即可。
PHP
sudo apt-get install php5-fpm
# Popular image manipulation library; used extensively by Wordpress and it's plugins.
sudo apt-get install php5-gd
# Makes the php5 command available to the terminal for php5 scripting
sudo apt-get install php5-cli
# Allows curl (file downloading tool) to be called from PHP5
sudo apt-get install php5-curl
# Provides encryption algorithms to PHP scripts
sudo apt-get install php5-mcrypt
# Allows PHP5 scripts to talk to a MySQL Database
sudo apt-get install php5-mysql
# Allows PHP5 scripts to use the readline function
sudo apt-get install php5-readline
其他的请自行安装
查看php5运行进程 ps -waux | grep php5
打开关闭php5进程
sudo service php5-fpm stop
sudo service php5-fpm start
sudo service php5-fpm restart
sudo service php5-fpm status
配置php5监听端口/etc/php5/fpm/pool.d/www.conf
把
listen = /var/run/php5-fpm.sock 改为
listen = 127.0.0.1:9000
重新运行php进程
Nginx
Ubuntu下Nginx进行多站点配置
sudo cp default cms
将如下修改为:
listen 80 default_server; -> listen 80;
server_name localhost; -> server_name yourdomain.com;
将如下注释或删除:
listen [::]:80 default_server ipv6only=on;
对应的目录也进行修改 然后执行下面命令,启动 cms
站点(将配置文件软链到sites-enabled
下)
sudo ln -s /etc/nginx/sites-available/cms /etc/nginx/sites-enabled/cms
重启Nginx:
sudo /etc/init.d/nginx reload
此时即可测试访问。