lanmp 环境搭建
2016-05-29 17:03
218 查看
软件分享:链接:http://pan.baidu.com/s/1dEbn229 密码:91xm一,安装Apache1,mini Linux安装必要包
16,附上 nginx 与php整合配置
yum -y grouplist yum -y groupinstall 'Development tools,Desktop Platform Development' yum -y groupinstall '开发工具,桌面平台开发'2,安装apr-1.5.0
# tar xf apr-1.5.0.tar.gz# cd apr-1.5.0# ./configure --prefix=/usr/local/apr# make && make install3,安装apr-util-1.5.3
# tar xf apr-util-1.5.3.tar.bz2# cd apr-util-1.5.3# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr# make && make install4,安装pcre
unzip pcre-8.32.zipcd pcre-8.32./configure --prefix=/usr/local/pcremake && make install5,安装Apache
5.1 出现openssl错误:yum -y install openssl-develtar xf httpd-2.4.10.tar.gzcd httpd-2.4.10./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre=/usr/local/pcre/ --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-mpm=event5.2 make && make install编辑/etc/httpd24/httpd.conf,添加如下行即可:shift+g定位到行尾PidFile "/var/run/httpd.pid"5.3 编辑一个/etc/rc.d/init.d/httpd-------------------------------------#!/bin/bash## httpd Startup script for the Apache HTTP Server## chkconfig: - 85 15# description: Apache is a World Wide Web server. It is used to serve \\# HTML files and CGI.# processname: httpd# config: /etc/httpd24/conf/httpd.conf# config: /etc/sysconfig/httpd# pidfile: /var/run/httpd.pid# Source function library.. /etc/rc.d/init.d/functionsif [ -f /etc/sysconfig/httpd ]; then. /etc/sysconfig/httpdfi# Start httpd in the C locale by default.HTTPD_LANG=${HTTPD_LANG-"C"}# This will prevent initlog from swallowing up a pass-phrase prompt if# mod_ssl needs a pass-phrase from the user.INITLOG_ARGS=""# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server# with the thread-based "worker" MPM; BE WARNED that some modules may not# work correctly with a thread-based MPM; notably PHP will refuse to start.# Path to the apachectl script, server binary, and short-form for messages.apachectl=/usr/local/apache/bin/apachectlhttpd=${HTTPD-/usr/local/apache/bin/httpd}prog=httpdpidfile=${PIDFILE-/var/run/httpd.pid}lockfile=${LOCKFILE-/var/lock/subsys/httpd}RETVAL=0start() {echo -n $"Starting $prog: "LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONSRETVAL=$?echo[ $RETVAL = 0 ] && touch ${lockfile}return $RETVAL}stop() {echo -n $"Stopping $prog: "killproc -p ${pidfile} -d 10 $httpdRETVAL=$?echo[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}}reload() {echo -n $"Reloading $prog: "if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; thenRETVAL=$?echo $"not reloading due to configuration syntax error"failure $"not reloading $httpd due to configuration syntax error"elsekillproc -p ${pidfile} $httpd -HUPRETVAL=$?fiecho}# See how we were called.case "$1" instart)start;;stop)stop;;status)status -p ${pidfile} $httpdRETVAL=$?;;restart)stopstart;;condrestart)if [ -f ${pidfile} ] ; thenstopstartfi;;reload)reload;;graceful|help|configtest|fullstatus)$apachectl $@RETVAL=$?;;*)echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"exit 1esacexit $RETVAL-----------------------------------------------5.4 添加脚本的执行权限chmod +x /etc/rc.d/init.d/httpdservice httpd start | stop二,安装nginx6,安装zlib
tar zxvf zlib-1.2.8.tar.gzcd zlib-1.2.8./configure --prefix=/usr/local/zlibmake && make install7,安装openssl
tar zxvf openssl-1.0.2-latest.tar.gztar zxvf nginx-1.7.12.tar.gzcp -R openssl-1.0.2a/ /usr/local/src/nginx-1.7.128,安装nginx
groupadd wwwwhereis nologinuseradd -g www -s /sbin/nologin wwwmkdir /usr/local/nginx/cd nginx-1.7.12./configure --prefix=/usr/local/nginx --user=www --group=www --sbin-path=/usr/local/nginx/sbin --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --error-log-path=/usr/local/nginx/nginx-error.log --with-http_ssl_module --with-pcre=/soft/lamp_linux/pcre-8.32 --with-zlib=/soft/lamp_linux/zlib-1.2.8 --with-openssl=/soft/lamp_linux/openssl-1.0.2emake && make installmkdir /usr/local/nginx/access 保持日志mkdir /usr/local/nginx/vhost 保持虚拟配置文件vi /etc/rc.d/init.d/nginx启动脚本:----------------------------------#!/bin/bash# nginx Startup script for the Nginx HTTP Server# it is v.0.0.2 version.# chkconfig: - 85 15# description: Nginx is a high-performance web and proxy server.# It has a lot of features, but it's not for everyone.# processname: nginx# pidfile: /var/run/nginx.pid# config: /usr/local/nginx/conf/nginx.confnginxd=/usr/local/nginx/sbinnginx_config=/usr/local/nginx/nginx.confnginx_pid=/usr/local/nginx/nginx.pidRETVAL=0prog="nginx"# Source function library.. /etc/rc.d/init.d/functions# Source networking configuration.. /etc/sysconfig/network# Check that networking is up.[ ${NETWORKING} = "no" ] && exit 0[ -x $nginxd ] || exit 0# Start nginx daemons functions.start() {if [ -e $nginx_pid ] ;thenecho "nginx already running...."exit 1fiecho -n $"Starting $prog: "daemon $nginxd -c ${nginx_config}RETVAL=$?echo[ $RETVAL = 0 ] && touch /var/lock/subsys/nginxreturn $RETVAL}# Stop nginx daemons functions.stop() {echo -n $"Stopping $prog: "killproc $nginxdRETVAL=$?echo[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx $nginx_pid}reload() {echo -n $"Reloading $prog: "#kill -HUP `cat ${nginx_pid}`killproc $nginxd -HUPRETVAL=$?echo}# See how we were called.case "$1" instart)start;;stop)stop;;reload)reload;;restart)stopstart;;status)status $progRETVAL=$?;;*)echo $"Usage: $prog {start|stop|restart|reload|status|help}"exit 1esacexit $RETVAL--------------------------------------授权:chmod 755 /etc/rc.d/init.d/nginxchkconfig nginx onservice nginx restart三,安装MySQL9,安装MySQL
tar zxvf mysql-5.6.15-linux-glibc2.5-x86_64.tar.gz -C /usr/local/cd /usr/local/ln -sv mysql-5.6.15-linux-glibc2.5-x86_64/ mysqlgroupadd -r mysqluseradd -g mysql -r -s /sbin/nologin -M -d /usr/local/mysql/data mysqlchown -R mysql:mysql .cd mysqlcp support-files/my-default.cnf /etc/my.cnfcp support-files/mysql.server /etc/rc.d/init.d/mysqldchmod +x /etc/rc.d/init.d/mysqldchkconfig --add mysqldchkconfig mysqld onyum -y install libaio-develscripts/mysql_install_db --user=mysqlservice mysqld start./bin/mysqladmin -u root password 'hadoop123'./bin/mysql -u root -p四,安装php10,安装bzip2
yum -y install bzip2-devel11,安装libmcrypt
tar zxvf libmcrypt-2.5.7.tar.gzcd libmcrypt-2.5.7./configure --prefix=/usr/local/libmcryptmake && make install12,安装libiconv
tar xf libiconv-1.14.tar.gzcd libiconv-1.14./configure --prefix=/usr/local/libiconvmake && make install13,安装libxml
cd libxml2-2.9.0./configure --prefix=/usr/local/libxml2 --with-zlib=/usr/local/zlib/make && make install14,安装curl
tar zxvf curl-7.42.0.tar.gzcd curl-7.42.0./configure --prefix=/usr/local/curlmake && make install15,安装php
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/local/libxml2 --enable-xml --enable-sockets --with-mcrypt=/usr/local/libmcrypt/ --with-config-file-path=/etc/ --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts --enable-fpm --disable-fileinfo --with-iconv=/usr/local/libiconv --with-curl=/usr/local/curlmake && make installcp php.ini-production /usr/local/php5.4/php5.4.iniln -sv /usr/local/php5.4/php5.4.ini /etc/php5.4.inivi /etc/php5.4.ini------------------------------------------------------------------------修改为:date.timezone = PRC #设置时区-----------------------------------------------------------------------cp /usr/local/php5.4/etc/php-fpm.conf.default /usr/local/php5.4/etc/php-fpm.confrm -rf /etc/php.d/*vi /usr/local/php5.4/etc/php-fpm.conf----------------------------------------------------------------------------pid = run/php-fpm5.4.pid #取消前面的分号--------------------------------------------------------------------------cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php5.4-fpmchmod +x /etc/rc.d/init.d/php5.4-fpmvi /etc/rc.d/init.d/php5.4-fpm
![](http://s4.51cto.com/wyfs02/M01/82/13/wKiom1dKssywHwm5AAAZ6m63eyA688.png-wh_500x0-wm_3-wmp_4-s_1444191775.png)
nginx.conf----------------------------------#user nobody;worker_processes 1;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;}http {include mime.types;default_type application/octet-stream;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 8m;sendfile on;tcp_nopush on;keepalive_timeout 60;tcp_nodelay on;fastcgi_connect_timeout 300;fastcgi_send_timeout 300;fastcgi_read_timeout 300;fastcgi_buffer_size 64k;fastcgi_buffers 4 64k;fastcgi_busy_buffers_size 128k;fastcgi_temp_file_write_size 128k;gzip on;gzip_min_length 1k;gzip_buffers 4 16k;gzip_http_version 1.0;gzip_comp_level 2;gzip_types text/plain application/x-javascript text/css application/xml;gzip_vary on;#limit_zone crawler $binary_remote_addr 10m;log_format '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';include /usr/local/nginx/vhost/*.conf;}-----------------------------------------------------vhost/test.conf------------------------------------------------------server{listen 80;#ssl on;server_name localhost;#ssl_certificate /ssl/server.crt;#ssl_certificate_key /ssl/server.key;#error_page 404 /404.html;location /404.html{}location / {autoindex on;root /opt/php/php_test/;index index.php index.html index.htm;if (-e $request_filename) {break;}if (!-e $request_filename) {rewrite ^/(.*)$ /index.php/$1 last;break;}}location ~ .+\.php($|/) {root /opt/php/php_test/;fastcgi_index index.php;fastcgi_split_path_info ^(.+\.php)(.*)$;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_INFO $fastcgi_path_info;fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;fastcgi_pass 127.0.0.1:9000;include fastcgi_params;}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$ {root /opt/php/php_test/;if (-f $request_filename) {expires 1d;break;}}#include /alidata/server/nginx/conf/rewrite/phpwind.conf;access_log /usr/local/nginx/access/localhost.log;}----------------------------END--------------------------------
相关文章推荐
- LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHP
- Ubuntu 14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL
- LNMP源码安装(RHEL)
- CentOS6 编译安装LNMP步骤
- 一个简洁的全自动安装LNMP服务器环境的Shell脚本分享
- 实战 LAMP 服务器配置 完整篇
- LNMP下防跨站、跨目录的安全设置,仅支持PHP5.3.3以上版本
- 64位CentOS 6.0下搭建LAMP环境详细步骤
- lnmp关闭mysql日志保护硬盘空间的方法
- centos6.5 编译安装lamp以及相关错误的解决方法
- CentOS 6.3编译安装LAMP环境笔记
- linux 安装配置lamp v2
- CentOS 6.3下源码安装LAMP(Linux+Apache+Mysql+Php)运行环境步骤
- 在Debian系统下配置LNMP的教程
- VPS中使用LNMP安装WordPress教程
- VPS CentOS-6 下 LNMP HTTP web服务器的搭建步骤
- 在CentOS上搭建LAMP+vsftpd环境的简单指南
- Linux操作系统安装LAMP环境
- 调整优化您的LAMP应用程序的5种简单方法
- linux服务器系统中手动配置lamp服务器的经验分享