LNMP��澧���寤�

涓�.nginx瀹�瑁�

1.涓�杞藉�瑰�褰���绯荤�������nginx��(package)

���wget�http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.寤虹��nginx��yum浠�搴�锛�榛�璁�yum��娌℃��nginx��锛�

���rpm -ivh�nginx-release-centos-7-0.el7.ngx.noarch.rpm

3.涓�杞藉苟瀹�瑁�nginx

���yum install nginx

4.nginx����锛�nginx瀹�瑁���褰�涓�锛�/usr/sbin/锛�

��systemctl start nginx.service

ps锛�涓�浜��跺��nginx�稿�冲�戒护锛�

nginx�稿�抽��缃���浠讹�

���榛�璁ょ����缃���浠跺�� /etc/nginx 璺�寰�涓�锛�浣跨�ㄨ�ラ��缃�宸茬���浠ユ�g‘�拌�琛�nginx锛�

���濡���瑕���瀹�涔�锛�淇��瑰�朵����nginx.conf 绛���浠跺�冲��锛�

�ㄦ�瑙��ㄥ�板����涓�杈��ラ�ㄧ讲nginx��澧����哄�ㄧ��IP锛�濡���涓���姝e父锛�搴�璇ヨ�界���板�涓�瀛��风����瀹广��

Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer tonginx.org.Commercial support is available atnginx.com.

Thank you for using nginx.

绗�浜�姝�:MYSQL瀹�瑁�

1.��涓�杞�mysql��repo婧�锛��稿�冲�戒护锛�

��wget�http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

2.瀹�瑁�mysql-community-release-el7-5.noarch.rpm��

锛�瀹�瑁�杩�涓�����锛�浼��峰�涓や釜mysql��yum repo婧�锛�/etc/yum.repos.d/mysql-community.repo锛�/etc/yum.repos.d/mysql-community-source.repo锛�

���rpm -ivh mysql-community-release-el7-5.noarch.rpm

3.瀹�瑁�MYSQL

���sudo yum install mysql-server

4.��缃�瀵���

����存�圭�ㄦ�锋����锛�

sudo chown -R root:root /var/lib/mysql

锛�寰�澶��跺��mysql��娉��ㄥ����锛�����涓�mysql���ユ������root,��mysql����mysql�ㄦ�疯韩浠芥�ц�褰��跺��涓�杩��讳�锛���绯荤���������棰�

灏�璇�浣跨��chown -R mysql:mysql /var/lib/mysql/��锛�

����������★�

systemctl restart mysql.service

����诲�锛�骞朵慨�瑰����锛�

mysql -u root


�� mysql > use mysql;


�� mysql > updateusersetpassword=password(��123456��) whereuser=��root��;


�� mysql > exit;

绗�涓�姝ワ�瀹�瑁�php

1.�ョ��褰���瀹�瑁���php����锛� yum�list�installed�|�grep�php锛�

���濡���瀛���php瀹�瑁��������や������� ���yum�remove 绉婚�� php�稿�崇����

2.rpm 瀹�瑁� Php7 �稿��� yum婧�

�� rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm


�� rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm


�朵� 楂�����

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm�

3.瀹�瑁�php7.0

yum install php70w

4.瀹�瑁�php�╁�

��php70w-mysql.x8664� �mysql�╁�锛�浣�涓轰�璧����跺��瑁� php70w-pdo.x8664锛�锛��ユ��姝ゆ�╁� 浣跨�� yum�list�|�grep�mysql ��ヨ�㈠���ㄦ�╁�������锛�

��php70w-gd.x86_64� GD搴�锛���php澶����惧舰���╁�搴�锛�GD搴���渚�浜�涓�绯诲���ㄦ�ュ����剧����API锛�浣跨��GD搴���浠ュ����剧��锛����������剧����

��php70w-ldap.x86_64� "杞婚��绾х��褰�璁块����璁�"锛���涓�涓��ㄤ�璁块��"��褰����″��"(Directory Servers)����璁�;

php70w-mbstring.x86_64� � mbstring�╁�搴��ㄤ�澶���澶�瀛���瀛�绗�涓�,PHP��缃���瀛�绗�涓查�垮害�芥��strlen��娉�姝g‘澶���涓���瀛�绗�涓诧�瀹�寰��扮������瀛�绗�涓叉������瀛����般��瀵逛�GB2312��涓���缂���锛�strlen寰��扮���兼��姹�瀛�涓��扮��2��锛���瀵逛�UTF-8缂�����涓���锛�灏辨��1~3����宸�寮�浜�������mb_strlen�芥�板��浠ヨ�濂藉�拌В�宠�涓���棰���

php70w-mcrypt.x86_64� � Mcrypt�╁�搴���浠ュ���板��瀵�瑙e�����斤�灏辨���㈣�藉�������瀵�锛�涔���浠ュ����杩�����

5.瀹�瑁�PHP FPM

���yum install php70w-fpm

�充� php锛�fpm

���PHP-FPM�跺����PHP婧�浠g����涓�涓�琛ヤ�锛��ㄥ�ㄥ�FastCGI杩�绋�绠$���村��杩�PHP��涓���蹇�椤诲�瀹�patch�颁���PHP婧�浠g��涓�锛��ㄧ�璇�瀹�瑁�PHP������浠ヤ娇�ㄣ��

����板�ㄦ��浠���浠ュ�ㄦ���扮��PHP 5.3.2��婧�������涓�杞藉��扮�存�ユ�村��浜�PHP-FPM������锛���璇翠�涓�����浼�����杩�PHP��涓诲�����汇���稿��Spawn-FCGI锛�PHP-FPM��CPU����瀛��归�㈢���у�堕�芥�磋��涓�绛癸���涓�����寰�瀹规��宕╂�锛�蹇�椤荤��crontab杩�琛����э���PHP-FPM��娌℃��杩�绉����笺��

���PHP5.3.3宸茬�����php-fpm浜�锛�涓�����绗�涓��圭����浜���PHP-FPM��渚�浜��村ソ��PHP杩�绋�绠$���瑰�锛���浠ユ�����у�跺��瀛���杩�绋�����浠ュ钩婊���杞�PHP��缃�锛�姣�spawn-fcgi�锋���村�浼��癸���浠ヨ�PHP瀹��规�跺�浜�����./configure���跺��甯� ��enable-fpm���板�冲��寮���PHP-FPM��

浣跨��PHP-FPM�ユ�у��PHP-CGI��FastCGI杩�绋�

绗���姝ワ���缃�nginx

淇��归��缃���浠朵���璁板�澶�浠�

1.nginx��缃���浠朵�缃�锛�锛�/etc/nginx/conf.d/default.conf锛�

���淇���web root��褰�锛�濡���娌℃����姹�涔���浠ヤ��ㄤ慨�癸�浣跨�ㄩ�璁ゅ�冲��锛�锛�

root /wwwdata/html;

�����缃�php瑙f��

�� location ~.php$ {


�� fastcgi_pass 127.0.0.1:9000;


�� fastcgi_index index.php;


��fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


�� include��� fastcgi_params;


�� }

2.php-fpm��缃���浠朵�缃�锛�锛�/etc/php-fpm.d/www.conf锛�

���淇���

user =nginx

���group=nginx

3.����nginx���★�

systemctl start nginx.service

���濡���璁剧疆寮��鸿����浣跨�ㄤ互涓��戒护锛�

sudo systemctl enable nginx.service

����ョ�����ㄧ�舵��锛�

systemctl status nginx�

���颁互涓�瀛��艰�存�����ㄦ����锛�

��Active: active (running) since �� 2016-11-19 13:40:04 CST; 50min ago

4.����PHP-FPM锛�

systemctl start php-fpm.service

��

�濡���璁剧疆寮��鸿����璇��ㄤ互涓��戒护锛�

sudo systemctl enable php-fpm.service

����ョ�����ㄧ�舵��锛�

systemctl status php-fpm.service

���颁互涓�瀛��艰�存�����ㄦ����锛�

��Active: active (running) since �� 2016-11-19 14:14:33 CST; 18min ago

�虫�わ�php锛�mysql锛�nginx ��澧���寤哄����锛�



��缃��茬��澧� 绔��B�

1锛���瀹�瑁�iptables-services���÷� ��杩�servvice�瑰���浣��茬��澧�

yum install iptables-services

姝ゅ�戒护浼��� /etc/sysconfig/涓�����涓�涓�iptables��浠堵��

2锛��ㄦ��浠朵�娣诲��瀵瑰���绔��f�㈠��


�充�Selinux�

�存��root��褰����跺���虹�颁釜��棰�� Nginx��缃�娌¢��棰�浣��存�㈣���灏辨��璁块��涓�浜�锛�error.log�ユ������璇�锛�� 缁�浜�777����杩���涓�琛�

��瑕���Selinux �虫��� 锛� /usr/sbin/sestatus� �ョ��瀹���杩�琛��舵��� 锛��vim /etc/selinux/config �婚��缃���浠跺����


瀹�瑁�redis�╁�

1��涓�杞�PHPRedis� git clone�https://github.com/nicolasff/phpredis

2��/usr/local/php7/bin/phpize #�句���phpize��璺�寰�����whereis�戒护�ョ��锛�whereis phpize 寰��拌矾寰�

3��./configure --with-php-config=/usr/local/php/bin/php-config #姝ゅ�涓�php-config��璺�寰�锛�����whereis php-config�ョ��璺�寰�

4��make && make install

你可能感兴趣的:(LNMP��澧���寤�)