centos6.5 x86_64下编译安装lnmp(2)

紧接上篇

6,安装nginx

1)安装 Nginx的rewrite模块支持包pcre库

tar zxvf pcre-8.36.tar.gz

cd pcre-8.36/

./configure

make && make install

cd ../

ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1

2)安装 Nginx

tar zxvf nginx-1.8.0.tar.gz

cd nginx-1.8.0/

./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

make && make install

cd ../

3)配置nginx

ln -sf /usr/local/nginx/sbin/nginx /usr/bin/nginx

(1)在/usr/local/nginx/conf/目录中创建nginx.conf文件:原配置文件只是基本配置文件,要实现其它功能还需要在此基础上进行修改。

cd /usr/local/nginx/conf/

cp nginx.conf nginx.conf.bk

新建即可

vi nginx.conf

user  nginx nginx;

worker_processes 1;

error_log  logs/nginx_error.log  crit;

pid        /usr/local/nginx/nginx.pid;

worker_rlimit_nofile 51200;

events

{

use epoll;

worker_connections 51200;

}

http

{

include       mime.types;

default_type  application/octet-stream;

#charset  gb2312;

server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

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;

server

{

listen       80;

server_name  localhost;

index index.php index.html index.htm;

root  /usr/local/nginx/html;

#location / {

#         root   html;

#         index  index.html index.htm;

# }

#limit_conn   crawler  20;

location ~ .*\.(php|php5)?$

{

#fastcgi_pass  unix:/tmp/php-cgi.sock;

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

include        fastcgi_params;

include fcgi.conf;

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$

{

expires      30d;

}

(2)在/usr/local/nginx/conf/目录中创建fcgi.conf文件:

说明:可以直接粘贴以下内容。

vi /usr/local/nginx/conf/fcgi.conf

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;

fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  QUERY_STRING       $query_string;

fastcgi_param  REQUEST_METHOD     $request_method;

fastcgi_param  CONTENT_TYPE       $content_type;

fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

fastcgi_param  REQUEST_URI        $request_uri;

fastcgi_param  DOCUMENT_URI       $document_uri;

fastcgi_param  DOCUMENT_ROOT      $document_root;

fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  REMOTE_ADDR        $remote_addr;

fastcgi_param  REMOTE_PORT        $remote_port;

fastcgi_param  SERVER_ADDR        $server_addr;

fastcgi_param  SERVER_PORT        $server_port;

fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param  REDIRECT_STATUS    200;

用如下命令检查配置是否正确

/usr/local/nginx/sbin/nginx -t

(3)启动nginx

/usr/local/nginx/sbin/nginx

将nginx加入系统服务

配置开机自动启动Nginx

vi /etc/rc.local

加入以下内容:

ulimit -SHn 51200

/usr/local/nginx/sbin/nginx

(4)测试nginx

vi /usr/local/nginx/html/index.php

<?php

phpinfo();

?>

iptables -I INPUT -p tcp --dport 80 -j ACCEPT

service mysql start

service php-fpm start

/usr/local/nginx/sbin/nginx

http://YOUR SERVERIP

校准本地时间

rm -rf /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

yum install -y ntp

ntpdate -u pool.ntp.org

date

关闭selinux

vi /etc/selinux/config

SELINUX=disabled

或者

sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config

setenforce 0

7.根据mysql版本下载对应的phpmyadmin版本,解压下载的phpmyadmin多语言包,解压的文件夹改名phpmyadmin,关闭iptables和selinux

http://www.phpmyadmin.net/downloads/

wget https://files.phpmyadmin.net/phpMyAdmin/4.4.12/phpMyAdmin-4.4.12-all-languages.zip

tar zxvf phpMyAdmin-4.4.12-all-languages.tar.gz

mv phpMyAdmin-4.4.12-all-languages phpmyadmin

将phpmyadmin移动到/usr/local/nginx/html下

chown -R nginx.nginx /usr/local/php/include/php/ext/session

http://YOUR SERVERIP/phpmyadmin,输入MySQL用户名和密码登录试试

时间: 2024-10-15 05:18:44

centos6.5 x86_64下编译安装lnmp(2)的相关文章

centos6.5 x86_64下编译安装strongswan

centos6.5 x86_64 1,安装必须的库 yum update yum install pam-devel openssl-devel make gcc 2,下载strongswan wget http://download.strongswan.org/strongswan.tar.gz tar xzf strongswan.tar.gz cd strongswan-* 3,编译安装 ./configure  --enable-eap-identity --enable-eap-md

centos6.5 x86_64下yum安装lnmp+phpmyadmin(2)

平台:centos6.5 x86_64最小化安装 上篇是安装的php.mysql版本有点老,安装个版本新一点的,尝尝鲜.^_^ 1,关闭SElinux vi /etc/selinux/config 将SELINUX=enforcing改为SELINUX=disabled reboot 2,添加yum源 vi nginx.repo                   nginx的源 [nginx] name=nginx repo baseurl=http://nginx.org/packages/

centos6.5 x86_64下yum安装lnmp+phpmyadmin

平台:centos6.5 x86_64 1,关闭SElinux vi /etc/selinux/config 将SELINUX=enforcing改为SELINUX=disabled reboot 2,添加yum源 rpm -Uvh http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6

centos下编译安装LNMP环境

自PHP-5.3.3起,PHP-FPM加入到了PHP核心,编译时加上--enable-fpm即可提供支持. PHP-FPM以守护进程在后台运行,Nginx响应请求后,自行处理静态请求,PHP请求则经过fastcgi_pass交由PHP-FPM处理,处理完毕后返回. Nginx和PHP-FPM的组合,是一种稳定.高效的PHP运行方式,效率要比传统的Apache和mod_php高出不少. 二.依赖环境 yum -y install gcc gcc-c++ make cmake automake au

centos6.7下编译安装lnmp

很多步骤不说明了,请参照本人的centos6.7下编译安装lamp,这次的架构是nginx+php-fpm一台服务器,mysql一台服务器 (1)首先编译安装nginx: 操作命令: yum -y groupinstall "Development Tools" "Server Platform Development" yum -y install pcre-devel  useradd -r nginx  mkdir /var/tmp/nginx   事先得创建

centos7下编译安装lnmp和nginx代理实验

1.先安装mysql cd /usr/local/src wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz tar zxvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql cd /usr/local/mysql useradd

CentOS 6.6 环境下 编译安装LNMP

环境:      OS:     CentOS 6.6     IP: 172.16.66.100    Nginx:  nginx-1.6.2    PHP:     php-5.4.40    Xcache: xcache-3.2.0    Mysql:  mariadb-5.5.43 一.前期环境准备: 1.根据官方ISO 创建本地yum源[[email protected] ~]# mkdir /mnt/cd [[email protected] ~]# mount /dev/cdrom

Linux下编译安装Lnmp

1.安装nginx 下载链接http://nginx.org/en/download.html (1)下载,解压 wget http://nginx.org/download/nginx-1.15.8.tar.gz tar zxf nginx-1.15.8.tar.gz cd nginx-1.15.8 (2)在编译安装之前先安装需要的依赖库和编译软件安装 yum install gcc gcc-c++ glibc -y yum install pcre-devel -y yum install

阿里云centos6.5实践编译安装LNMP架构web环境

LNMP 代表的就是:Linux系统下Nginx+MySQL+PHP这种网站服务器架构. 本次测试需求: **实践centos6.5编译安装 LNMP生产环境 架构 web生产环境 使用 ngx_pagespeed 优化前端 xcache 优化php 用 google_perftools 优化nginx 和 php内存分配 ** 作为 Web 服务器:相比 Apache,Nginx 使用更少的资源,支持更多的并发连接,体现更高的效率. 作为负载均衡服务器:Nginx 既可以在内部直接支持Rail