centos65编译安装lamp和lnmp

Posted 莲花味精

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos65编译安装lamp和lnmp相关的知识,希望对你有一定的参考价值。

Linux Apache mysql php source install

CentOS6.5 Minimal setup

*可选 更换yum源


yum install gcc gcc-c++ setuptool ntsysv iptables vim system-config-securitylevel-tui system-config-network-tui openssl-devel curl-devel gd-devel libjpeg-devel perl perl-devel libxml2 libxml2-devel

1.apr1.6.2 ./configure --prefix=/usr/local/apr

2.expat2.2.1 ./configure --prefix=/usr/local/expat

3.apr-util1.6.0 ./configure --prefix=/usr/local/apu --with-apr=/usr/local/apr --with-expat=/usr/local/expat

4.pcre8.10 ./configure --prefix=/usr/local/pcre

5.httpd2.4.25 ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apu --with-pcre=/usr/local/pcre


6.mysql5.7 rpm -Uvh mysql57-community-release-el6-11.noarch.rpm

7.mcrypt2.5.8 ./configure --prefix=/usr/local/mcrypt

8.php5.6.30

./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-static --enable-maintainer-zts --enable-inline-optimization --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-soap --with-zlib --with-iconv --with-gd --with-xmlrpc --enable-mbstring --with-curl --enable-ftp --with-freetype-dir=/usr/bin --with-jpeg-dir=/usr/bin --with-png-dir=/usr/bin --disable-ipv6 --disable-debug --with-openssl --disable-maintainer-zts --disable-fileinfo --with-mcrypt=/usr/local/mcrypt


nginx
Pre-Built Packages for Stable version

To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “6” or “7”, for 6.x or 7.x versions, respectively.


yum install nginx

(php7.1.8
./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-static --enable-maintainer-zts --enable-inline-optimization --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-soap --with-zlib --with-iconv --with-gd --with-xmlrpc --enable-mbstring --with-curl --enable-ftp --with-freetype-dir=/usr/bin --with-jpeg-dir=/usr/bin --with-png-dir=/usr/bin --disable-ipv6 --disable-debug --with-openssl --disable-maintainer-zts --disable-fileinfo --with-mcrypt=/usr/local/mcrypt --with-openssl --enable-fpm
)
Wrote PEAR system config file at: /usr/local/php7/etc/pear.conf
You may want to add: /usr/local/php7/lib/php to your php.ini include_path
/root/soft/php-7.1.8/build/shtool install -c ext/phar/phar.phar /usr/local/php7/bin
ln -s -f phar.phar /usr/local/php7/bin/phar
Installing PDO headers: /usr/local/php7/include/php/ext/pdo/


开启两个nginx配置文件
配置nginx,server配置
{
server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;
root /www
location / {
index index.html index.htm index.php l.php;
autoindex off;
try_files $uri $uri/ /index.php?$query_string;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.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;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache‘s document root
# concurs with nginx‘s one
#
#location ~ /\.ht {
# deny all;
#}
}

}

 

配置apache

vim /usr/local/apache2/conf/httpd.conf

Addtype application/x-httpd-php .php

开启rewrite模块,去掉#

将AllowOverride 改为All

 

svnserver的安装

1.sqlite3.19.3 ./configure --prefix=/usr/local/sqlite

./configure --prefix=/usr/local/svn --with-apr=/usr/local/apr --with-apr-util=/usr/local/apu

 

以上是关于centos65编译安装lamp和lnmp的主要内容,如果未能解决你的问题,请参考以下文章

LNMP源码编译安装及一键部署LNMP架构

CentOS-7 编译安装 Zabbix-3.0

PHP介绍及安装

PHP介绍及安装

源码编译安装LNMP及论坛部署

web服务之源码编译安装LNMP