lnmp源码安装以及简单配置,lnmp源码配置_PHP教程

WBOY
发布: 2016-07-12 08:57:45
原创
709 人浏览过

lnmp源码安装以及简单配置,lnmp源码配置

 nginx 软件:

a: openssl-<span>1.0</span><span>.1r.tar.gz
  tar zxf openssl</span>-<span>1.0</span><span>.1r.tar.gz
b: pcre</span>-<span>8.32</span><span>.tar.gz
  tar zxf openssl</span>-<span>1.0</span><span>.1r.tar.gz
  cd pcre</span>-<span>8.32</span><span>
      .</span>/configure --prefix=/usr/local/lanmp/lib/<span>pcre #安装目录
      make </span>&&<span> make install
c: zlib</span>-<span>1.2</span>.<span>7</span><span>.tar.gz 
      tar zxf zlib</span>-<span>1.2</span>.<span>7</span><span>.tar.gz
  cd  zlib</span>-<span>1.2</span>.<span>7</span><span>
      .</span>/configure --prefix=/usr/local/lanmp/lib/<span>zlib #安装目录
      make </span>&&<span> make install
d: nginx</span>-<span>1.8</span>.<span>0</span><span>.tar.gz
  tar zxf nginx</span>-<span>1.8</span>.<span>0</span><span>.tar.gz
      cd nginx
      #</span>--user=www-<span>data 指定用户
      #</span>--group=www-<span>data 指定用户组
      </span>--prefix=/usr/local/lanmp/<span>nginx
      </span>--with-<span>http_ssl_module #开启HTTP SSL模块,支持HTTPS请求
      </span>--with-openssl=/usr/local/src/openssl-<span>1.0</span><span>.1r #源码的路径
      </span>--with-zlib=/usr/local/src/zlib-<span>1.2</span>.<span>7</span><span> #源码的路径
      </span>--with-pcre=/usr/local/src/pcre-<span>8.32</span><span> #源码的路径
      </span>--conf-path=/etc/lanmp/<span>nginx.conf#配置文件路径
     
      make </span>&&<span> make install

      </span>/usr/local/lanmp/nginx/sbin/<span>nginx #启动nignx,也可加入服务
      cp </span>/usr/local/lanmp/nginx/sbin/nginx /etc/init.d/ 
登录后复制

nginx简单配置:

<span>全局:
worker_processes  </span><span>2</span><span>;#进程数

worker_rlimit_nofile </span><span>65535</span><span>;#最多打开文件数

events {
    use epoll; #事件模型
    worker_connections  </span><span>10240</span><span>;#每个进程最多连接数
}

http局:
    keepalive_timeout  </span><span>0</span><span>;#超时时间

    gzip  on; #支持压缩
    gzip_buffers </span><span>16</span><span> 8K; #申请内存大小
    gzip_comp_level </span><span>6</span><span>;#压缩级别
    gzip_min_length 4K;#允许压缩的最小字节数
    gzip_types text</span>/html,text/<span>css;#压缩类型
    gzip_vary on;#根据http头部来判断是否压缩

   server局:
        location </span>~ .*(gif|jpg|png|bmp|<span>swf)$ {#缓存类型
           expires 1d; #缓存时间
       }</span>
登录后复制

mysql 软件:

mysql-<span>5.6</span>.<span>15</span><span>.tar.gz

tar zxf mysql</span>-<span>5.6</span>.<span>15</span><span>.tar.gz
cd mysql</span>-<span>5.6</span>.<span>15</span><span>
#必须安装以下的包,不然cmake会出错
yum </span>-y install ncurses-devel 或者 apt-<span>get</span> install libncurses5-<span>dev  

cmake . \
</span>-DCMAKE_INSTALL_PREFIX=/usr/local/lanmp/<span>mysql \ 
</span>-DMYSQL_DATADIR=/usr/local/lanmp/mysql/<span>data \ #数据库存放路径
</span>-DSYSCONFDIR=/etc/lanmp/<span>mysql \ #conf路径
</span>-DWITH_MYISAM_STORAGE_ENGINE=<span>1</span><span> \ #MYISAM引擎支持
</span>-DWITH_INNOBASE_STORAGE_ENGINE=<span>1</span><span> \#INNODB引擎支持
</span>-DWITH_MEMORY_STORAGE_ENGINE=<span>1</span><span> \#MEMORY引擎支持
</span>-DWITH_READLINE=<span>1</span><span> \
</span>-DMYSQL_UNIX_ADDR=/<span>var</span>/lib/mysql/<span>mysql.sock \
</span>-DMYSQL_TCP_PORT=<span>3306</span><span> \
</span>-DENABLED_LOCAL_INFILE=<span>1</span><span> \#允许从本地导入数据
</span>-DWITH_PARTITION_STORAGE_ENGINE=<span>1</span><span> \#分区支持
</span>-DEXTRA_CHARSETS=<span>all \
</span>-DDEFAULT_CHARSET=<span>utf8 \
</span>-DDEFAULT_COLLATION=<span>utf8_general_ci #字符集

make </span>&&<span> make install

groupadd mysql #建一个mysql用户组
useradd </span>-r -g mysql mysql #建一个mysql用户,属于mysql用户组,并且该用户不在登录界面显示(-<span>r参数的作用)

chown </span>-R mysql:mysql /usr/local/lanmp/<span>mysql

cd</span>/usr/local/lanmp/mysql/<span>scripts
.</span>/mysql_install_db --user=mysql --basedir=/usr/local/lanmp/mysql --datadir=/usr/local/lanmp/<span>mysql #初始化安装

cd </span>/usr/local/lanmp/mysql/support-<span>files

#注册服务
cp mysql.server </span>/etc/init.d/<span>mysqld

#使用默认配置文件
cp my</span>-<span>default</span>.cnf /etc/lanmp/mysql/<span>my.cnf

#启动
service mysqld start

</span>/usr/local/lanmp/mysql/bin/mysqladmin -u root password <span>"</span><span>123456</span><span>"</span> #设置密码
登录后复制

mysql简单配置:

innodb_buffer_pool_size =<span> 128M

port </span>= <span>3306</span><span>
server_id </span>= <span>1</span><span>
socket </span>= /<span>var</span>/lib/mysql/<span>mysql.sock


back_log </span>= <span>384</span><span>
key_buffer_size </span>=<span> 128M
max_connections </span>= <span>500</span><span>
thread_concurrency </span>= <span>2</span>
登录后复制

php 软件:

a: freetype-<span>2.4</span>.<span>10</span><span>.tar
b: jpegsrc.v8b.tar.gz
c: libpng</span>-<span>1.5</span>.<span>14</span><span>.tar.gz
d: libxml2</span>-<span>2.9</span>.<span>0</span><span>.tar.gz
e: libiconv</span>-<span>1.7</span><span>.tar.gz

同样是解压并安装</span>/usr/local/lanmp/lib/<span>下

f: php</span>-<span>7.0</span>.<span>3</span><span>.tar.gz
    tar zxf php</span>-<span>7.0</span>.<span>3</span><span>.tar.gz
    cd php</span>-<span>7.0</span>.<span>3</span><span>
    .</span>/configure --prefix=/usr/local/lanmp/<span>fcgphp
    </span>--with-config-file-path=/etc/lanmp/<span>fcgphp.ini
    </span>--with-mysqli=/usr/local/lanmp/mysql/bin/<span>mysql_config #mysqli
    </span>--enable-<span>mbstring
    </span>--with-freetype-dir=/usr/local/lanmp/lib/<span>freetype
    </span>--with-jpeg-dir=/usr/local/lanmp/lib/<span>libjpeg #jpg
    </span>--with-png-dir=/usr/local/lanmp/lib/<span>libpng  #png
    </span>--with-zlib-dir=/usr/local/lanmp/lib/<span>zlib
    </span>--with-libxml-dir=/usr/local/lanmp/lib/<span>libxml
    </span>--enable-<span>xml #xml支持
    </span>--with-iconv-dir=/usr/local/lanmp/lib/<span>libiconv#字符集转换支持
    </span>--enable-<span>fpm #支持fcgi方式
    </span>--with-pdo-mysql=/usr/local/lanmp/<span>mysql#pdo支持
   #</span>--with-apxs2=/usr/local/lanmp/apache2/bin/<span>apxs#apache模块
   make </span>&&<span> 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>dynamic</span><span> #进程方式,static为静态
pm.max_children </span>= <span>300</span><span> #最大进程数
pm.start_servers </span>= <span>20</span><span> #启动时创建的进程
pm.min_spare_servers </span>= <span>5</span><span> #最小进程数
pm.max_spare_servers </span>= <span>35</span> #空闲最大进程数
登录后复制

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1106378.htmlTechArticlelnmp源码安装以及简单配置,lnmp源码配置 nginx 软件: a: openssl- 1.0 .1r.tar.gz tar zxf openssl - 1.0 .1r.tar.gzb: pcre - 8.32 .tar.gz tar zxf openssl - 1.0 .1r.tar....
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板