Installation Package introduction:
Install the specified software as required. Nginx is installed in/usr/local/nginx by default, and the startup script is in/usr/local/nginx/conf/nginx; php is installed in/usr/local/php, the STARTUP script is/usr/local/php/sbin/php-fpm. mysql is installed in/usr/local/mysql and the startup script is/etc/init. d/mysqld.
Write the installation scripts of each service as functions in sequence. The script file is in the lib folder, and in different script files, declare the script file in the main function install, and then call the corresponding function as needed. The installation package is in the src directory. The required nginx and php configuration files are in the conf directory.
User Guide:./install. sh -- mysql -- nginx. You can install mysql and nginx services.
1. Install the specified software based on your needs. In what way? For example, install -- nginx -- mysql. Only nginx and mysql are installed.
Solution: Use case + for Loop
For (I = 1; I <= $ VarNum; I ++) # VarNum =$ # equals to the number of input variables. Use this to loop.
Do
Case $ {! I} in # after obtaining the value of I, take out the variable corresponding to this value. If it matches one of the following, the corresponding function is called.
-- Nginx) ins_nginx ;;
-- Mysql) ins_mysql ;;
-- Php)
Ins_pecl
Ins_apc
Ins_php ;;
-- Memcache) ins_memcache ;;
*) Helpme
Exit ;;
Esac
Done
2. An error is reported after mysql is installed,
Processing Method: according to the source file instructions. You must modify the two fields in the/etc/init. d/mysqld file.
Datadir =/data/mysql
Basedir =/usr/local/mysql
Specify the data storage path and installation directory of mysql.
Iii. Connection between php and nginx. The nginx service is normal. php-fpm has been started, but php files cannot be browsed.
Processing Method: add the configuration in the nginx. conf configuration file
Location ~ \. Php $ {# locate all requests ending with php
Root html;
Fastcgi_pass 127.0.0.1: 9000; # the address and port must be the same as the configuration file of php-fpm.
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME html $ fastcgi_script_name; # note that here, html specifies the PHP file path, which is the relative path. It is in the same directory as the static page.
Include fastcgi_params;
}
Iv. mysql functions have an endless loop and are always calling and installing mysql functions.
Processing Method: sed-I '/^ PATH/s # & #:/usr/local/mysql/bin #'/root/. bash_profile
Source/root/. bash_profile
Comment out the two rows.
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Build and install the LNMP production environment in CentOS 6.4
Practical Production Environment-LNMP architecture compilation and installation + SSL encryption implementation
LNMP full-featured compilation and installation for CentOS 6.3 notes
Install LNMP in CentOS 6.3 (PHP 5.4, MyySQL5.6)
Nginx startup failure occurs during LNMP deployment.
Ubuntu install Nginx php5-fpm MySQL (LNMP environment setup)