How To Install Linux, Nginx, MySQL, PHP (LEMP) Stack on Debian 7
2016-05-06 18:33
746 查看
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-debian-7
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-ubuntu-14-04
At the moment, we only need to do a thorough update:
To install MySQL, open terminal and type in these commands:
During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.
Once you have installed MySQL, we should activate it with this command:
nginx needs a command to begin running:
nginx.conf的第一行是user www-data;
把这个项目目录的权限修改下
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-nginx-on-ubuntu-14-04
1) Update Apt-Get
The apt-get update command is used to re-synchronize the package index files from their sources. If used in combination with the apt-get upgrade command, they install the newest versions of all packages currently available.At the moment, we only need to do a thorough update:
sudo apt-get update
2) Install MySQL on your VPS
MySQL is a powerful database management system used for organizing and retrieving dataTo install MySQL, open terminal and type in these commands:
sudo apt-get install mysql-server
During the installation, MySQL will ask you to set a root password. If you miss the chance to set the password while the program is installing, it is very easy to set the password later from within the MySQL shell.
Once you have installed MySQL, we should activate it with this command:
3) Install and Configure Nginx on your VPS
Installation
Initial installation is simple with the apt-get command.sudo apt-get install nginx
nginx needs a command to begin running:
sudo service nginx start
Configuration
vim /etc/nginx/nginx.conf, 在http中加入以下代码,server { listen 80; root /opt/app/blog/wz/wordpress/; index index.php index.html index.htm; server_name iwangzheng.com; location / { try_files $uri $uri/ /index.html; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
nginx.conf的第一行是user www-data;
把这个项目目录的权限修改下
sudo chown -R www-data:www-data /opt/app/blog/wz/wordpress/
4) Install and Configure PHP
Installation
You probably guessed it! We will use the apt-get command to install PHP-FPM:sudo apt-get install php5-fpm php5-mysql
sudo service nginx restart sudo service php5-fpm restart
相关文章推荐
- rsync 配置
- nginx上传文件大小限制修改
- Nginx教程(四) Location配置与ReWrite语法
- 最全面 Nginx 入门教程 + 常用配置解析
- 使用 Nginx 提升网站访问速度
- nginx的upstream目前支持的5种方式的分配
- ansible 安装 nginx
- nginx入门
- nginx
- Nginx启动流程
- nginx学习之一
- 企业级nginx服务优化(四 )伪静态+php.ini
- nginx源码学习资源
- 第2章 Nginx的配置
- LNMP(linux+nginx+mysql+php)服务器环境配置
- Nginx负载均衡配置实例详解
- nginx php fastcgi Connection reset by peer的原因及解决办法
- Nginx(负载均衡)+keepalived(双机热备)
- [nginx] 网上最全面nginx教程(近100篇文章整理)
- Nginx的工作模式和一些理解