https://www.cnblogs.com/xxoome/p/5884063.html
https://blog.csdn.net/remotesupport/article/details/13022935
yum -y install make gcc lua-devel pcre-devel openssl-devel
cd LuaJIT-2.0.4/
make
make install PREFIX=/usr/local/luajit
cd nginx-1.9.7
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_random_index_module --with-http_realip_module --with-http_sub_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_addition_module --with-http_geoip_module --with-ld-opt=-Wl,-rpath,/usr/local/luajit/lib --add-module=/root/lnmp/ngx_devel_kit-master/ --add-module=/root/lnmp/lua-nginx-module-master/
make && make install
nginx -s reload
nginx -V
1 yum update
2 rpm -Uvh http://mirrors.kernel.org/fedora-epel/epel-release-latest-6.noarch.rpm
3 yum -y install bzip2-devel curl-devel freetype-devel gcc libjpeg-devel libpng-devel libxslt-devel libxml2-devel openssl-devel pcre-devel pcre-devel zlib-devel
4 tar -zxvf php-7.2.6.tar.gz
5 cd php-7.2.6
6 ./configure --prefix=/usr/local/php7 --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with- pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --ena ble-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip
7 make
8 make install
9 /usr/local/php/bin/php -v
10 tar -zxvf nginx-1.9.7.tar.gz
11 tar -zxvf php-5.5.4.tar.gz
12 cd nginx-1.9.7
13 yum install gd-devel
14 yum -y install GeoIP GeoIP-devel GeoIP-data
15 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_random_index_module --with-http_realip_module --with-http_sub_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_addition_module --with-http_geoip_module
16 make && make install
17 cd php-5.5.4
18 ./configure --prefix=/usr/local/php5 --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with- pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --ena ble-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --with-mysql
如果已经安装了可能会进行升级,版本完全一致则不会进行任何操作。
yum -y install bzip2-devel curl-devel freetype-devel gcc libjpeg-devel libpng-devel libxslt-devel libxml2-devel openssl-devel pcre-devel pcre-devel zlib-devel
http://www.jquerycn.cn/a_16599
yum install libmcrypt libmcrypt-devel mcrypt mhash
--with-mcrypt
1、下载php
下载地址:http://php.net/get/php-7.0.11.tar.gz/from/a/mirror
下载“php-7.0.11.tar.gz”后移动到linux服务器的任意目录下,只在编译时指定安装到的目录。
2、解压安装包
tar -zxvf php-7.0.11.tar.gz
cd php-7.0.11
3、配置安装变量
./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip
“/usr/local/php”是安装路径,可以改成自己喜欢的安装路径。
4、编译源码
# 在解压目录执行编译命令:make
cd php-7.0.11 make
编译会花费一些时间,耐心等待即可。编译完成的最后会提示你执行make test命令。就是对上一步 make 的检查,
要确保 make 是没有错误的,也就是这一步的 test、check要全部是 OK 的,error 为0。
5、安装php
make install
6、配置PHP
将PHP源码包(/usr/local/php-7.0.11)中的php.ini-development文件复制到/usr/local/php/下,更名为php.ini。
cp /usr/local/php-7.0.11/php.ini-development /usr/local/php/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
配置php.ini “cgi.fix_pathinfo=0”
启动php-fpm服务:
/usr/local/php/sbin/php-fpm
启动完毕之后,php-fpm服务默认使用9000端口,使用 netstat -tln | grep 9000 可以查看端口使用情况:
7、配置nginx
nginx安装教程:http://www.cnblogs.com/xxoome/p/5866475.html
编辑nginx配置文件/usr/local/nginx/conf/nginx.conf,主要修改nginx的server {}配置块中的内容,修改location块,追加index.php让nginx服务器默认支持index.php为首页:
然后配置.php请求被传送到后端的php-fpm模块,默认情况下php配置块是被注释的,此时去掉注释并修改为以下内容:
这里面很多都是默认的,root是配置php程序放置的根目录,主要修改的就是fastcgi_param中的/scripts为$document_root
修改完这些保存并退出,然后重启nginx:/usr/local/nginx/sbin/nginx -s reload
接下来编辑一个测试的php程序,在nginx下的html目录下创建test.php文件,打印一下php配置:
<?php phpinfo(); ?>
然后打开浏览器输入对应的地址进行访问,看到输出页面,说明nginx和php都配置成功了
rpm -qf /usr/bin/scp
rpm -ql opensslnginx
cat /etc/yum.repos.d/epel.repocd redis-2.2.5
[root@lnmp redis-5.0.0]# cp /root/lnmp/php-7.2.6/ext/openssl/config0.m4 ./config.m4
[root@lnmp redis-5.0.0]# /usr/local/php/bin/phpize
echo "${name} 你的dev环境账户已创建,请下载私钥并保存好。" | mailx -s "dev环境账户创建" -a /home/${name}/.ssh/id_rsa-dev-docker_${name} ${name}@shtest.com
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '"$http_x_forwarded_for" - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $remote_addr';
sendfile on;
keepalive_timeout 65;
server {
listen 80 default_server;
server_name yansiyu.test-zhifu.test.com;
root /data/dev.www/yansiyu.dev.test.com/public;
access_log /data/dev.www/logs/access.log main;
error_log /data/dev.www/logs/error.log;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if ($host !~ (.*news\.test\.com$|.*test\.com$|.*test\.com$)) {
fastcgi_pass 127.0.0.1:9055;
}
if ($host ~ .*news\.test\.com$) {
fastcgi_pass 127.0.0.1:9072;
}
if ($host ~ .*test\.com$) {
fastcgi_pass 127.0.0.1:9072;
}
if ($host ~ .*test\.com$) {
fastcgi_pass 127.0.0.1:9072;
}
if ($host ~ .*test\.com$) {
fastcgi_pass 127.0.0.1:9072;
}
}
}
}
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '"$http_x_forwarded_for" - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $remote_addr';
sendfile on;
keepalive_timeout 65;
server {
listen 80 default_server;
root /data/dev.www/${host}/public;
access_log /data/dev.www/logs/access.log main;
error_log /data/dev.www/logs/error.log;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if ($host !~ (.*news\.test\.com$|.*test\.com$)) {
fastcgi_pass 127.0.0.1:9055;
}
if ($host ~ .*news\.test\.com$) {
fastcgi_pass 127.0.0.1:9072;
}
if ($host ~ .*test\.com$) {
fastcgi_pass 127.0.0.1:9072;
}
}
}
}
如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术
转载请注明:lnmp lua编译安装 出自老鄢博客 | 欢迎分享