数据库: sudo apt-get install mysql-server mysql-client 然后设置数据库ROOT用户的秘密,两次,确认。然后数据库安装成功 Nginx : sudo add-apt-repository ppa:nginx/stablesudo apt-get updatesudo apt-get install nginx 这个命令可以从PPA软件管理里
数据库:
sudo apt-get install mysql-server mysql-client
Nginx :
sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo apt-get install nginx
nginx -v
安装之后,要启动nginx
sudo service nginx start
PHP5
这里是通过PHP-FPM来让PHP5在nginx里工作,当然如果喜欢FastCGI的朋友,可以自己去弄。
sudo apt-get install php5-fpm
sudo vi /etc/nginx/sites-available/default
以下是某个例子:
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php index.html index.htm; # Make site accessible from http://localhost/ server_name localhost; location / { try_files $uri $uri/ /index.php; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; allow ::1; deny all; } # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { # With php5-fpm: try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }
sudo service nginx reload
sudo vi /usr/share/nginx/html/info.php
<?php phpinfo(); ?>
打开浏览器,查看
参考文件:http://ubuntuhandbook.org/index.php/2013/10/install-nginx-php5-mysql-lemp-ubuntu-1310/