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

來源:互聯網
上載者:User

標籤:

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 VPSInstallation

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 PHPInstallation

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 restartsudo service php5-fpm restart



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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.