1.安装nginx
apt-get install nginx
2.启动nginx
service nginx start
3.访问服务器ip
如果看到“welcome to nginx!”说明安装好了。
4.安装php
apt-get install php5-fpm
5.配置nginx
vi /etc/nginx/sites-available/default
找到下列代码,去掉相应注释
location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php5-fpm.sock;}
重启服务
service nginx restart
6.默认的网站根目录在/var/www/html
vi /var/www/html/test.php
输入以下内容,并保存
访问网站ip/test.php,如果可以看到phpinfo的信息说明php安装成功。
').addclass('pre-numbering').hide(); $(this).addclass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadein(1700); }); }); 以上就介绍了ubuntu常用服务器环境搭建——nginx+php篇,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。