码迷,mamicode.com
首页 > 数据库 > 详细

How To Install Linux, Nginx, MySQL, PHP (LEMP) Stack on Debian 7

时间:2016-05-07 10:26:34      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:

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

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 data

To 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



How To Install Linux, Nginx, MySQL, PHP (LEMP) Stack on Debian 7

标签:

原文地址:http://blog.csdn.net/shiralwz/article/details/51333783

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!