In the study of Linux on the journey, encountered a variety of problems, has been resolved to take notes
Key installation
[more detailed explanation from]lnmp.org pages
Installing the LNMP stable version
Wget-c http://soft.vpser.net/lnmp/lnmp1.3-full.tar.gz && tar zxf lnmp1.3-full.tar.gz && CD Lnmp1.3-full &&/install.sh Lnmp
For more details, see lnmp.org.
Installing a cache such as Redis
Please look at https://lnmp.org/faq/addons.html.
Two Yum installations [learn http://blog.chinaunix.net/uid-26744202-id-5746873.html]
1, install EPEL source EPEL Source as a supplement to the official CentOS source, inside are some basic packages (Https://fedoraproject.org/wiki/EPEL official website)
- RPM-UVH http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
2, install Remi Source, Remi Source is almost all the latest stable version, are the Linux Bone Maintenance update (http://rpms.famillecollet.com/official website)
- RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
3, start installing PHP,
- =============================================================================================================== ======== N/S matched:php-fpm ==================================================================================== ====================================
- php-fpm.x86_64:php FastCGI Process Manager
- php56-php-fpm.x86_64:php FastCGI Process Manager
- php70-php-fpm.x86_64:php FastCGI Process Manager
- php71-php-fpm.x86_64:php FastCGI Process Manager
PHP-FPM defaults to 5.3, which is recommended to install PHP56
- Yum install--enablerepo=remi php56-php-fpm php56-php-mysqld Php56-php-redis
Optional installation of Php56-eaccelerator, or PHP-PECL-APC, and OPCAHCE are all PHP accelerators.
Yum install--enablerepo=remi php56-php-pear php56-php-devel Php56-php-opcache
- Chkconfig--level 2345 PHP56-PHP-FPM on
Start PHP-FPM
- Service PHP56-PHP-FPM Restart
4, install MySQL
- yum-y--enablerepo=remi install MySQL Mysql-server
- Chkconfig--level 2345 mysqld on
- Service mysqld Start
Start setting up mysqld with the Mysql_secure_installation command, and then modify the MySQL profile path as you like mysql_install_db--defaults-file=/etc/my.cnf (// View MySQL Boot profile Ps-ef | grep mysqld)
Ps:
Default MySQL password is empty press ENTER directly
6. Install and run Redis
- Yum Install--enablerepo=remi Redis
- Service Redis Start
7, install Nginx
Click ( here) to collapse or open
- Yum Install Nginx
- Service Nginx Start
Modify PHP Session Save method
Vim/opt/remi/php56/root/etc/php-fpm.d/www.conf
Find Session Modification
Php_value[session.save_handler] = Redis
Php_value[session.save_path] = "tcp://127.0.0.1:6379"
Finally shut down the firewall
/etc/init.d/iptables stop
If you encounter the session cannot save the situation, please check the session to save the directory
#建立session保存目录
Mkdir/var/lib/php/session
Chmod-r 777/var/lib/php/session
I was having trouble installing MySQL.
- File/usr/share/mysql/italian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/japanese/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/korean/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with file From Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts With file from the package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/norwegian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/polish/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with file From Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/portuguese/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/romanian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/russian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/serbian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/slovak/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with file From Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/spanish/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/swedish/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
- File/usr/share/mysql/ukrainian/errmsg.sys from install of mysql-server-community-5.1.58-1.rhel5.i386 conflicts with File from Package mysql-libs-5.1.52-1.el6_0.1.i686
Error Summary reason is packet conflict
The solution is to erase all the packages.
Yum Remove mysql-libs-5.1.52*
Remove and install again
After installing various environments, the second step is to let Nginx support PHP
Find the default.conf under the Nginx.
- # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- #location ~ \.php$ {
- # root HTML;
- # Fastcgi_pass 127.0.0.1:9000;
- # Fastcgi_index index.php;
- # Fastcgi_param Script_filename/scripts$fastcgi_script_name;
- # include Fastcgi_params;
- #}
Because Nginx is not associated with PHP by default, so here
The revision was changed to
-
- Location ~ \.php$ {
- root/usr/share/nginx/html;
- Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
- Fastcgi_pass 127.0.0.1:9000;
- Fastcgi_index index.php;
- Try_files $uri = 403;
- Fastcgi_param script_filename $request _filename;
- Include Fastcgi_params;
- }
Then, all the files will be parsed with the default index.php, in order to prioritize the resolution of that kind of file
- Location/{
- root/usr/share/nginx/html;
- Index index.html index.htm;
- }
Revision changed to
- Location/{
- root/usr/share/nginx/html;
- Index index.php index.html index.htm;
- }
This way, Nginx can parse the PHP file.
In addition, this can be combined with the socket to perform PHP-FPM to optimize the speed, in the specific way
Find php-fpm.d/www.conf and modify the
- Listen = 127.0.0.1:9000
Change it to
- Listen =/tmp/php-fcgi.sock
Also pay attention to the permissions problem, the default mode is 0660 restart PHP-FPM will not be able to read fcgi need to change to 0666
; Listen.owner = php-fpm
; listen.group = php-fpm
Listen.mode = 0666
And then in Nginx parsing PHP modified Fastcgi_pass execution mode for the socket
- Location ~ \.php$ {
- root/usr/share/nginx/html;
- Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
- Fastcgi_pass Unix:/tmp/php-fcgi.sock;
- Fastcgi_index index.php;
- Try_files $uri = 403;
- Fastcgi_param script_filename $request _filename;
- Include Fastcgi_params;
- }
So the PHP-FPM is executed in socket mode.
Upload file size
Vim/etc/nginx/nginx.conf
Client_max_body_size 10M;
Linux Installation Development Tools