标签:mcrypt des ram events tcp 代理 done case level
若之前服务器有mysql,再次安装需要把之前mysql删除干净。MySQL数据文件夹可删可不删
#删除分三步 #先删除MySQL文件包 rm -rf /usr/local/mysql #再删除启动文件 rm -rf /etc/init.d/mysqld #删除配置文件 rm -rf /etc/my.cnf
之后为安装MySQL,首先下载mysql二进制免编译包
[root@localhost src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
再解压该二进制免编译包。
[root@localhost src]# tar -zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
移动解压后的文件,移动前确认目标地无MySQL文件夹
[root@localhost src]# ls /usr/local/mysql ls: 无法访问/usr/local/mysql: 没有那个文件或目录 [root@localhost src]# mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql
创建MySQL数据文件夹,并创建mysql用户
useradd mysql mkdir /data/
编译安装mysql,出现两个OK则成功
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
安装会出现一些错误
#error 1 [root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory #解决办法 [root@localhost mysql]# yum install -y libaio #error 2 [root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql -bash: ./scripts/mysql_install_db: /usr/bin/perl: 坏的解释器: 没有那个文件或目录 #解决办法 [root@localhost mysql]# yum -y install autoconf 再次编译安装,验证输出 [root@localhost mysql]# echo $? 0
拷贝配置文件和启动脚本
#配置文件 [root@localhost mysql]# cp ./support-files/my-default.cnf /etc/my.cnf #启动脚本 [root@localhost mysql]# cp ./support-files/mysql.server /etc/init.d/mysqld
修改配置文件和启动脚本,主要修改这两项
basedir datadir
修改启动脚本权限为755,开机自启
[root@localhost mysql]# chmod 755 /etc/init.d/mysqld [root@localhost mysql]# chkconfig --add mysqld
启动MySQL
[root@localhost mysql]# /etc/init.d/mysqld start Starting MySQL.Logging to ‘/data/mysql/localhost.localdomain.err‘. . SUCCESS!
命令行方式启动
/usr/local/mysql/bin/mysqld_safe --default-file=/etc/my.cnf --user=mysql --data=/data/mysql
杀进程可以用killall mysqld,系统会继续等待mysql传输数据,直到全部完成才会自动关闭。
在mysqld写数据的时候,如果杀死mysqld进程,发现杀不死,不要强制-9杀,有可能会直接导致正在传输的数据丢失,表损坏。
和LAMP安装PHP方法有差别,需要开启php-fpm服务
下载php源码包
[root@localhost src]# wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
解压
[root@localhost src]# tar zxf php-5.6.30.tar.gz
创建用户
useradd -s /sbin/nologin php-fpm
编译安装
./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl
安装错误见LAMP文件,其中未包含的错误有以下
configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/ #解决方法 yum install -y curl curl-devel
最后make && make install 可能需要10分钟左右。
安装成功后
查看php文件发现,LAMP和LNMP的php文件是有区别的
#LNMP [root@localhost php-5.6.30]# ls /usr/local/php-fpm/ bin etc include lib php sbin var #多一个sbin和var文件 #sbin文件是存放php服务启动文件 [root@localhost php-5.6.30]# ls /usr/local/php-fpm/sbin/ php-fpm #var里面放的是日志文件和存放pid [root@localhost php-5.6.30]# ls /usr/local/php-fpm/var/ log run #LAMP [root@chy002 ~]# ls /usr/local/php/ bin etc include lib php
-m 查看模块,-i 查看phpinfo,-t查看配置文件是否正确
#两个都可以 [root@localhost php-5.6.30]# /usr/local/php-fpm/bin/php -m [root@localhost php-5.6.30]# /usr/local/php-fpm/sbin/php-fpm -m
拷贝修改配置文件,php.ini用来控制php某些功能
#拷贝生产环境下配置文件 [root@localhost etc]# cp php.ini-production /usr/local/php-fpm/etc/php.ini #修改配置文件 [root@localhost etc]# mv php-fpm.conf.default php-fpm.conf [root@localhost etc]#vi /usr/local/php/etc/php-fpm.conf [global] pid = /usr/local/php-fpm/var/run/php-fpm.pid error_log = /usr/local/php-fpm/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock listen.mode = 666 user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024
拷贝启动脚本
[root@localhost etc]# cp /usr/local/src/php-5.6.30/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm [root@localhost etc]# chmod 755 /etc/init.d/php-fpm [root@localhost etc]# chkconfig --add php-fpm [root@localhost etc]# chkconfig php-fpm on [root@localhost etc]# service php-fpm start Starting php-fpm done
检测一下
[root@localhost etc]# ps aux|grep php root 21666 0.0 0.4 124228 4944 ? Ss 05:31 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf) php-fpm 21667 0.0 0.4 124228 4704 ? S 05:31 0:00 php-fpm: pool www php-fpm 21668 0.0 0.4 124228 4704 ? S 05:31 0:00 php-fpm: pool www php-fpm 21669 0.0 0.4 124228 4704 ? S 05:31 0:00 php-fpm: pool www php-fpm 21670 0.0 0.4 124228 4704 ? S 05:31 0:00 php-fpm: pool www php-fpm 21671 0.0 0.4 124228 4708 ? S 05:31 0:00 php-fpm: pool www php-fpm 21672 0.0 0.4 124228 4708 ? S 05:31 0:00 php-fpm: pool www php-fpm 21673 0.0 0.4 124228 4708 ? S 05:31 0:00 php-fpm: pool www php-fpm 21674 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21675 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21676 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21677 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21678 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21679 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21680 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21681 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21682 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21683 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21684 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21685 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www php-fpm 21686 0.0 0.4 124228 4712 ? S 05:31 0:00 php-fpm: pool www root 21688 0.0 0.0 112724 980 pts/0 S+ 05:33 0:00 grep --color=auto php [root@localhost etc]# ls -l /tmp/php-fcgi.sock srw-rw-rw-. 1 root root 0 5月 15 05:31 /tmp/php-fcgi.sock
处理静态文件能力更强。
Nginx官网 nginx.org,最新版1.13,最新稳定版1.12
Nginx应用场景:web服务、反向代理、负载均衡
Nginx著名分支,淘宝基于Nginx开发的Tengine,使用上和Nginx一致,服务名,配置文件名都一样,和Nginx的最大区别在于Tenging增加了一些定制化模块,在安全限速方面表现突出,另外它支持对js,css合并
Nginx核心+lua相关的组件和模块组成了一个支持lua的高性能web容器openresty,参考 http://jinnianshilongnian.iteye.com/blog/2280928
下载并解压安装包
cd /usr/local/src wget http://nginx.org/download/nginx-1.12.1.tar.gz tar zxf nginx-1.12.1.tar.g
编译安装
#自定义安装,无任何参数安装 [root@localhost nginx-1.12.1]# ./configure --prefix=/usr/local/nginx [root@localhost nginx-1.12.1]# make && make install
编辑启动脚本,更改权限
#编辑启动脚本 [root@localhost nginx-1.12.1]# vi /etc/init.d/nginx #!/bin/bash # chkconfig: - 30 21 # description: http service. # Source Function Library . /etc/init.d/functions # Nginx Settings NGINX_SBIN="/usr/local/nginx/sbin/nginx" NGINX_CONF="/usr/local/nginx/conf/nginx.conf" NGINX_PID="/usr/local/nginx/logs/nginx.pid" RETVAL=0 prog="Nginx" start() { echo -n $"Starting $prog: " mkdir -p /dev/shm/nginx_temp daemon $NGINX_SBIN -c $NGINX_CONF RETVAL=$? echo return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc -p $NGINX_PID $NGINX_SBIN -TERM rm -rf /dev/shm/nginx_temp RETVAL=$? echo return $RETVAL } reload() { echo -n $"Reloading $prog: " killproc -p $NGINX_PID $NGINX_SBIN -HUP RETVAL=$? echo return $RETVAL } restart() { stop start } configtest() { $NGINX_SBIN -c $NGINX_CONF -t return 0 } case "$1" in start) start ;; stop) stop ;; reload) reload ;; restart) restart ;; configtest) configtest ;; *) echo $"Usage: $0 {start|stop|reload|restart|configtest}" RETVAL=1 esac exit $RETVAL #更改权限 [root@localhost nginx-1.12.1]# chmod 755 /etc/init.d/nginx
开机自启
[root@localhost nginx-1.12.1]# chkconfig --add nginx [root@localhost nginx-1.12.1]# chkconfig nginx on
修改配置文件
cd /usr/local/nginx/conf/ mv nginx.conf nginx.conf.bak vim nginx.conf user nobody nobody; worker_processes 2; error_log /usr/local/nginx/logs/nginx_error.log crit; pid /usr/local/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 6000; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 3526; server_names_hash_max_size 4096; log_format combined_realip ‘$remote_addr $http_x_forwarded_for [$time_local]‘ ‘ $host "$request_uri" $status‘ ‘ "$http_referer" "$http_user_agent"‘; sendfile on; tcp_nopush on; keepalive_timeout 30; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; connection_pool_size 256; client_header_buffer_size 1k; large_client_header_buffers 8 4k; request_pool_size 4k; output_buffers 4 32k; postpone_output 1460; client_max_body_size 10m; client_body_buffer_size 256k; client_body_temp_path /usr/local/nginx/client_body_temp; proxy_temp_path /usr/local/nginx/proxy_temp; fastcgi_temp_path /usr/local/nginx/fastcgi_temp; fastcgi_intercept_errors on; tcp_nodelay on; gzip on; gzip_min_length 1k; gzip_buffers 4 8k; gzip_comp_level 5; gzip_http_version 1.1; gzip_types text/plain application/x-javascript text/css text/htm application/xml; server { listen 80; server_name localhost; index index.html index.htm index.php; root /usr/local/nginx/html; location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/tmp/php-fcgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; } } }
启动服务
#查看配置文件是否有错误 /usr/local/nginx/sbin/nginx -t #启动服务 /etc/init.d/nginx start netstat -lntp |grep 80
标签:mcrypt des ram events tcp 代理 done case level
原文地址:https://www.cnblogs.com/chyuanliu/p/9038647.html