环境: 14.04.1-Ubuntuphp
apt-get install nginx
ubantu安装完Nginx后,文件结构大体为:html
全部的配置文件都在 /etc/nginx下 ;mysql
启动程序文件在 /usr/sbin/nginx下;nginx
日志文件在 /var/log/nginx/下,分别是access.log和error.log;git
而且在 /etc/init.d下建立了启动脚本nginxgithub
安装完成后能够尝试启动nginx:sql
/etc/init.d/nginx start
而后能经过浏览器访问到 http://localhost/, 一切正常,如不能访问请检查缘由。ubuntu
sudo apt-get install php5-fpm
sudo apt-get install php5-gd # Popular image manipulation library; used extensively by Wordpress and it's plugins.
sudo apt-get install php5-cli # Makes the php5 command available to the terminal for php5 scripting
sudo apt-get install php5-curl # Allows curl (file downloading tool) to be called from PHP5
sudo apt-get install php5-mcrypt # Provides encryption algorithms to PHP scripts
sudo apt-get install php5-mysql # Allows PHP5 scripts to talk to a MySQL Database
sudo apt-get install php5-readline # Allows PHP5 scripts to use the readline function
查看php5运行进程:vim
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
nginx的配置文件 /etc/nginx/nginx.conf中include了/etc/nginx/sites-enabled/*,所以能够去修改/etc/nginx/sites-enabled下的配置文件
vi /etc/nginx/sites-available/default作以下修改:
location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
# try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
还须要在/etc/nginx/fastcgi_params添加以下两句:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
而后reload Nginx:
sudo service nginx reload
新建phpinfo.php文件:
sudo vim /usr/share/nginx/html/phpinfo.php内容以下:
<?php phpinfo(); ?>
而后经过浏览器访问: http://localhost/phpinfo.php
可以看到php的详细信息则说明配置成功。
五、下载phpssdbadmin
下载phpssdbadmin到/usr/share/nginx/html目录下:
cd /usr/share/nginx/html
git clone https://github.com/ssdb/phpssdbadmin.git
五、配置phpssdbadmin
修改phpssdbadmin的配置,修改app/config/config.php,将host和port改成ssdb配置的值:
'ssdb' => array(
'host' => '127.0.0.1',
'port' => '8888',
),
若是使用新版的phpssdbadmin,还须要修改用户名和密码,由于原始密码太简单不容许登陆:
'login' => array(
'name' => 'jinghao',
'password' => 'jinghao123', // at least 6 characters
),
修改nginx的配置文件:
vim /etc/nginx/sites-enabled/default
添加:
location /phpssdbadmin {
try_files $uri $uri/ /phpssdbadmin/index.php?$args;
index index.php;
}
而后访问 http://localhost/phpssdbadmin ,出现登陆页面则配置成功。
参考:
http://blog.csdn.net/skyie53101517/article/details/46053767
http://blog.csdn.net/cool_sti/article/details/41517991
http://ubuntuhandbook.org/index.php/2013/10/install-nginx-php5-mysql-lemp-ubuntu-1310/
https://github.com/ssdb/phpssdbadmin