首页 > 后端开发 > php教程 > lnmp源码安装以及容易配置

lnmp源码安装以及容易配置

WBOY
发布: 2016-06-13 12:28:48
原创
888 人浏览过

lnmp源码安装以及简单配置

 nginx 软件:

a: openssl-<span style="color: #800080;">1.0</span><span style="color: #000000;">.1r.tar.gz  tar zxf openssl</span>-<span style="color: #800080;">1.0</span><span style="color: #000000;">.1r.tar.gzb: pcre</span>-<span style="color: #800080;">8.32</span><span style="color: #000000;">.tar.gz  tar zxf openssl</span>-<span style="color: #800080;">1.0</span><span style="color: #000000;">.1r.tar.gz  cd pcre</span>-<span style="color: #800080;">8.32</span><span style="color: #000000;">      .</span>/configure --prefix=/usr/local/lanmp/lib/<span style="color: #000000;">pcre #安装目录      make </span>&&<span style="color: #000000;"> make installc: zlib</span>-<span style="color: #800080;">1.2</span>.<span style="color: #800080;">7</span><span style="color: #000000;">.tar.gz       tar zxf zlib</span>-<span style="color: #800080;">1.2</span>.<span style="color: #800080;">7</span><span style="color: #000000;">.tar.gz  cd  zlib</span>-<span style="color: #800080;">1.2</span>.<span style="color: #800080;">7</span><span style="color: #000000;">      .</span>/configure --prefix=/usr/local/lanmp/lib/<span style="color: #000000;">zlib #安装目录      make </span>&&<span style="color: #000000;"> make installd: nginx</span>-<span style="color: #800080;">1.8</span>.<span style="color: #800080;">0</span><span style="color: #000000;">.tar.gz  tar zxf nginx</span>-<span style="color: #800080;">1.8</span>.<span style="color: #800080;">0</span><span style="color: #000000;">.tar.gz      cd nginx      #</span>--user=www-<span style="color: #000000;">data 指定用户      #</span>--group=www-<span style="color: #000000;">data 指定用户组      </span>--prefix=/usr/local/lanmp/<span style="color: #000000;">nginx      </span>--with-<span style="color: #000000;">http_ssl_module #开启HTTP SSL模块,支持HTTPS请求      </span>--with-openssl=/usr/local/src/openssl-<span style="color: #800080;">1.0</span><span style="color: #000000;">.1r #源码的路径      </span>--with-zlib=/usr/local/src/zlib-<span style="color: #800080;">1.2</span>.<span style="color: #800080;">7</span><span style="color: #000000;"> #源码的路径      </span>--with-pcre=/usr/local/src/pcre-<span style="color: #800080;">8.32</span><span style="color: #000000;"> #源码的路径      </span>--conf-path=/etc/lanmp/<span style="color: #000000;">nginx.conf#配置文件路径           make </span>&&<span style="color: #000000;"> make install      </span>/usr/local/lanmp/nginx/sbin/<span style="color: #000000;">nginx #启动nignx,也可加入服务      cp </span>/usr/local/lanmp/nginx/sbin/nginx /etc/init.d/ 
登录后复制

nginx简单配置:

<span style="color: #000000;">全局:worker_processes  </span><span style="color: #800080;">2</span><span style="color: #000000;">;#进程数worker_rlimit_nofile </span><span style="color: #800080;">65535</span><span style="color: #000000;">;#最多打开文件数events {    use epoll; #事件模型    worker_connections  </span><span style="color: #800080;">10240</span><span style="color: #000000;">;#每个进程最多连接数}http局:    keepalive_timeout  </span><span style="color: #800080;">0</span><span style="color: #000000;">;#超时时间    gzip  on; #支持压缩    gzip_buffers </span><span style="color: #800080;">16</span><span style="color: #000000;"> 8K; #申请内存大小    gzip_comp_level </span><span style="color: #800080;">6</span><span style="color: #000000;">;#压缩级别    gzip_min_length 4K;#允许压缩的最小字节数    gzip_types text</span>/html,text/<span style="color: #000000;">css;#压缩类型    gzip_vary on;#根据http头部来判断是否压缩   server局:        location </span>~ .*(gif|jpg|png|bmp|<span style="color: #000000;">swf)$ {#缓存类型           expires 1d; #缓存时间       }</span>
登录后复制

 

 mysql 软件:

mysql-<span style="color: #800080;">5.6</span>.<span style="color: #800080;">15</span><span style="color: #000000;">.tar.gztar zxf mysql</span>-<span style="color: #800080;">5.6</span>.<span style="color: #800080;">15</span><span style="color: #000000;">.tar.gzcd mysql</span>-<span style="color: #800080;">5.6</span>.<span style="color: #800080;">15</span><span style="color: #000000;">#必须安装以下的包,不然cmake会出错yum </span>-y install ncurses-devel 或者 apt-<span style="color: #0000ff;">get</span> install libncurses5-<span style="color: #000000;">dev  cmake . \</span>-DCMAKE_INSTALL_PREFIX=/usr/local/lanmp/<span style="color: #000000;">mysql \ </span>-DMYSQL_DATADIR=/usr/local/lanmp/mysql/<span style="color: #000000;">data \ #数据库存放路径</span>-DSYSCONFDIR=/etc/lanmp/<span style="color: #000000;">mysql \ #conf路径</span>-DWITH_MYISAM_STORAGE_ENGINE=<span style="color: #800080;">1</span><span style="color: #000000;"> \ #MYISAM引擎支持</span>-DWITH_INNOBASE_STORAGE_ENGINE=<span style="color: #800080;">1</span><span style="color: #000000;"> \#INNODB引擎支持</span>-DWITH_MEMORY_STORAGE_ENGINE=<span style="color: #800080;">1</span><span style="color: #000000;"> \#MEMORY引擎支持</span>-DWITH_READLINE=<span style="color: #800080;">1</span><span style="color: #000000;"> \</span>-DMYSQL_UNIX_ADDR=/<span style="color: #0000ff;">var</span>/lib/mysql/<span style="color: #000000;">mysql.sock \</span>-DMYSQL_TCP_PORT=<span style="color: #800080;">3306</span><span style="color: #000000;"> \</span>-DENABLED_LOCAL_INFILE=<span style="color: #800080;">1</span><span style="color: #000000;"> \#允许从本地导入数据</span>-DWITH_PARTITION_STORAGE_ENGINE=<span style="color: #800080;">1</span><span style="color: #000000;"> \#分区支持</span>-DEXTRA_CHARSETS=<span style="color: #000000;">all \</span>-DDEFAULT_CHARSET=<span style="color: #000000;">utf8 \</span>-DDEFAULT_COLLATION=<span style="color: #000000;">utf8_general_ci #字符集make </span>&&<span style="color: #000000;"> make installgroupadd mysql #建一个mysql用户组useradd </span>-r -g mysql mysql #建一个mysql用户,属于mysql用户组,并且该用户不在登录界面显示(-<span style="color: #000000;">r参数的作用)chown </span>-R mysql:mysql /usr/local/lanmp/<span style="color: #000000;">mysqlcd</span>/usr/local/lanmp/mysql/<span style="color: #000000;">scripts.</span>/mysql_install_db --user=mysql --basedir=/usr/local/lanmp/mysql --datadir=/usr/local/lanmp/<span style="color: #000000;">mysql #初始化安装cd </span>/usr/local/lanmp/mysql/support-<span style="color: #000000;">files#注册服务cp mysql.server </span>/etc/init.d/<span style="color: #000000;">mysqld#使用默认配置文件cp my</span>-<span style="color: #0000ff;">default</span>.cnf /etc/lanmp/mysql/<span style="color: #000000;">my.cnf#启动service mysqld start</span>/usr/local/lanmp/mysql/bin/mysqladmin -u root password <span style="color: #800000;">"</span><span style="color: #800000;">123456</span><span style="color: #800000;">"</span> #设置密码
登录后复制

mysql简单配置:

innodb_buffer_pool_size =<span style="color: #000000;"> 128Mport </span>= <span style="color: #800080;">3306</span><span style="color: #000000;">server_id </span>= <span style="color: #800080;">1</span><span style="color: #000000;">socket </span>= /<span style="color: #0000ff;">var</span>/lib/mysql/<span style="color: #000000;">mysql.sockback_log </span>= <span style="color: #800080;">384</span><span style="color: #000000;">key_buffer_size </span>=<span style="color: #000000;"> 128Mmax_connections </span>= <span style="color: #800080;">500</span><span style="color: #000000;">thread_concurrency </span>= <span style="color: #800080;">2</span>
登录后复制

 

 php 软件:

a: freetype-<span style="color: #800080;">2.4</span>.<span style="color: #800080;">10</span><span style="color: #000000;">.tarb: jpegsrc.v8b.tar.gzc: libpng</span>-<span style="color: #800080;">1.5</span>.<span style="color: #800080;">14</span><span style="color: #000000;">.tar.gzd: libxml2</span>-<span style="color: #800080;">2.9</span>.<span style="color: #800080;">0</span><span style="color: #000000;">.tar.gze: libiconv</span>-<span style="color: #800080;">1.7</span><span style="color: #000000;">.tar.gz同样是解压并安装</span>/usr/local/lanmp/lib/<span style="color: #000000;">下f: php</span>-<span style="color: #800080;">7.0</span>.<span style="color: #800080;">3</span><span style="color: #000000;">.tar.gz    tar zxf php</span>-<span style="color: #800080;">7.0</span>.<span style="color: #800080;">3</span><span style="color: #000000;">.tar.gz    cd php</span>-<span style="color: #800080;">7.0</span>.<span style="color: #800080;">3</span><span style="color: #000000;">    .</span>/configure --prefix=/usr/local/lanmp/<span style="color: #000000;">fcgphp    </span>--with-config-file-path=/etc/lanmp/<span style="color: #000000;">fcgphp.ini    </span>--with-mysqli=/usr/local/lanmp/mysql/bin/<span style="color: #000000;">mysql_config #mysqli    </span>--enable-<span style="color: #000000;">mbstring    </span>--with-freetype-dir=/usr/local/lanmp/lib/<span style="color: #000000;">freetype    </span>--with-jpeg-dir=/usr/local/lanmp/lib/<span style="color: #000000;">libjpeg #jpg    </span>--with-png-dir=/usr/local/lanmp/lib/<span style="color: #000000;">libpng  #png    </span>--with-zlib-dir=/usr/local/lanmp/lib/<span style="color: #000000;">zlib    </span>--with-libxml-dir=/usr/local/lanmp/lib/<span style="color: #000000;">libxml    </span>--enable-<span style="color: #000000;">xml #xml支持    </span>--with-iconv-dir=/usr/local/lanmp/lib/<span style="color: #000000;">libiconv#字符集转换支持    </span>--enable-<span style="color: #000000;">fpm #支持fcgi方式    </span>--with-pdo-mysql=/usr/local/lanmp/<span style="color: #000000;">mysql#pdo支持   #</span>--with-apxs2=/usr/local/lanmp/apache2/bin/<span style="color: #000000;">apxs#apache模块   make </span>&&<span style="color: #000000;"> make install   cp php.ini</span>-development /etc/lanmp/fcgphp.ini<br>   <br>  cd /usr/local/lanmp/fcgphp/etc/php-fpm.d/<br>  cp www.conf.default www.conf #配置
登录后复制
<em id="__mceDel">  #启动<br>   /usr/local/lanmp/fcgphp/sbin/php-fpm</em>
登录后复制

php-fpm配置参数

pm = <span style="color: #0000ff;">dynamic</span><span style="color: #000000;"> #进程方式,static为静态pm.max_children </span>= <span style="color: #800080;">300</span><span style="color: #000000;"> #最大进程数pm.start_servers </span>= <span style="color: #800080;">20</span><span style="color: #000000;"> #启动时创建的进程pm.min_spare_servers </span>= <span style="color: #800080;">5</span><span style="color: #000000;"> #最小进程数pm.max_spare_servers </span>= <span style="color: #800080;">35</span> #空闲最大进程数
登录后复制

 

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板