centos 6.8 nginx+mysql+php

centos6.4 nginx+mysql+php整合phpmyadmin出错施工方案,centos6.4nginx

今日在centos下结合phpmyadmin出错,错误提醒如下:

Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

在Google上转了瞬间,找到了想要的答案,特意记录下来

在php.ini中开启
session.save_path = "/var/lib/php/session/"

原文:

 

session.save_path = "/var/lib/php/session"
drwxr-xr-x  2 root apache 4096 Feb 16 04:47 session

 

今日在centos下结合phpmyadmin出错,错误提醒如下:

装了成都百货上千次机,做了成都百货上千次重复专门的学问,最终,总计以下装CentOS经验:

一、安装所需软件包
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng
libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib
zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses
ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel
libidn libidn-devel openssl openssl-devel openldap openldap-devel
nss_ldap openldap-clients openldap-servers
二、安装扩充库
1、下载libiconv
wget
下载实现后
tar -zxvf libiconv-1.14.tar.gz && cd libiconv-1.14
./configure –prefix=/usr/local
make && make install
2、安装libmcrypt
wget

1:查看情状:
    

centos配置 nginx +mysql +PHP 有未有大约方法

yum安装最简便
www.centos.bz/…-lnmp/
 

Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

注:相当多主题材料实际上都不是主题材料,先把seLinux关了!setenforce
0 ,不然会死的十分惨!

下载实现后
tar -zxvf libmcrypt-2.5.8.tar.gz && cd libmcrypt-2.5.8
./configure &&  make && make install
/sbin/ldconfig && cd libltdl
./configure –enable-ltdl-install
make && make install

[root@123 /]# cat /etc/redhat-release
CentOS release 6.8 (Final)

centos5,进级php后phpmyadmin不得以登入

貌似景色是PHP.ini配置难点,依照下边包车型客车配置项再设置一遍,然后重启服务器,试试!

(1) 设置增加路线

查找 extension_dir 有这么一行

;extension_dir = “./”

在此行前边加入一行(注意是步向一行,不是加到后边)

extension_dir = “d:\php\ext”

其中d:\php是你安装php的不二诀要。路线不正确将不能够加载dll

(2) 查找 extension

extension=php_mbstring.dll

extension=php_gd2.dll

extension=php_mysql.dl

把上边3项后边的分店去掉,那样IIS运维时就足以加载那个dll了

(3) 设置会话保存路线

查找session.save_path 有这么一行

; session.save_path = “N;/path”

在此行后步向一行

session.save_path = “C:\Windows\Temp”

封存到您的权且目录下,这里完全能够保存到Windows不时目录Temp下

(4) 还会有相比较值得注意的是 short_open_tag 默认是Off的

也等于说 php不可能利用短标识如 <? ?> 必需选择<?php ?>

是因为短标识使用方便,而且非常多程序也是用不久标志来写,如discuz等

要是不把 short_open_tag
改成On将现出的症状将很难肯定是上边原因,这里提议修改

查找

short_open_tag = Off

改为

short_open_tag = On

(5) 是不是出示错误 display_errors

是因为安全性思虑,display_errors 也默感到 Off

身为在调度时,假诺php代码有误,就只现身三个空白页。而不会显得出错原因和失误行数。

那样调节和测量检验起来将不胜狼狈,建议依照自身索要修改

查找

reGISter_globals = Off

改成

register_globals = On

(6) register_globals

由于安全性思量它暗中同意也是Off

当register_globals=Off的时候,下三个主次接收的时候理应用$_POST[‘user_name’]和$_POST[‘user_pass’])

当register_globals=On的时候,下叁个顺序能够直接行使$user_name和$user_pass来接受值。

提出根据本身供给修改…余下全文>>
 

nginx+mysql+php整合phpmyadmin出错建设方案,centos6.4nginx
明日在centos下结合phpmyadmin出错,错误提醒如下: Error during session
start; please che…

在谷歌(Google)上转了须臾间,找到了想要的答案,特意记录下来

1,先更新源

3、安装mhash
wget
完成后
tar -zxvf mhash-0.9.9.9.tar.gz && cd mhash-0.9.9.9
./configure && make && make install
4、软链接
ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

  

在php.ini中开启
session.save_path = "/var/lib/php/session/"

启用国内的源:163或sohu

5、安装mcrypt
wget
今昔做到后tar -zxvf mcrypt-2.6.8.tar.gz && cd mcrypt-2.6.8/
./configure && make && make install

2:关掉防火墙
    

原文:

163:

三、安装MySQL
wget

tar -zxvf mysql-5.5.25.tar.gz
cd mysql-5.5.25
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql -M -s /sbin/nologin mysql
为制止出现下边的报错:

[root@123 /]# chkconfig iptables off

http://stackoverflow.com/questions/5013118/cannot-start-session-without-errors-in-phpmyadmin
 

假定想选择新的软件,建议用REPL和remi的源

Could NOT find Curses  (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)

 

session.save_path = "/var/lib/php/session"
drwxr-xr-x  2 root apache 4096 Feb 16 04:47 session
#remi的源  rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm  rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6      #Fedora REPL的源  rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm  rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi

CMake Error at cmake/readline.cmake:83 (MESSAGE):

3:配置CentOS 6.0 第三方yum源(CentOS暗中同意的行业内部源里未有nginx软件包)
    

 

然后 yum update 进级系统

  Curses library not found.  Please install appropriate package,

[root@123 /]# wget http://www.atomicorp.com/installers/atomic     

[root@123 /]# sh ./atomic     

[root@123 /]#yum check-update

 

 

  

下边才是安装大家供给的软件,比如 nginx+php+php-fpm+mysql+vsftpd等

      remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package
name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.

4:安装开采包和库文件 
    

 

率先安装:
yum -y install ncurses-devel

[root@123 /]# yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel

以下参照他事他说加以考察那篇小说:参考小说

cmake -DCMAKE_INSTALL_PREFIX=/your_path/mysql/ \

  

上面开始安插:

-DMYSQL_DATADIR=/yourpath/mysqldata/ \

  (放在一行试行)

1,设置系统时间

-DSYSCONFDIR=/etc/mysqld/ \

5:卸载已设置的apache、mysql、php
    

  cp /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime

-DDEFAULT_CHARSET=utf8\

[root@123 /]# yum remove httpd     

[root@123 /]# yum remove mysql     

[root@123 /]# yum remove php

  date #查看系统时间

-DEXTRA_CHARSETS=all\

  

  */30 * * * * /usr/sbin/ntpdate time.nist.gov

-DDEFAULT_COLLATION=utf8_general_ci\

6:安装nginx
    

     crontab -e

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,all\

[root@123 /]# yum install nginx

[root@123 /]# service nginx start

[root@123 /]# chkconfig --levels 235 nginx on //设2、3、5级别开机启动

  加入那行:*/30 * * * * /usr/sbin/ntpdate time.nist.gov

-DWITH_MYISAM_STORAGE_ENGINE=1\

  

2,更新系统

-DWITH_INNOBASE_STORAGE_ENGINE=1\

7:安装mysql
    

  yum update

-DWITH_ARCHIVE_STORAGE_ENGINE=1\

[root@123 /]# yum install mysql mysql-server mysql-devel     

[root@123 /]# service mysqld start

3,安装Nginx:

-DWITH_MEMORY_STORAGE_ENGINE=1\

拉开时蒙受报错 Can’t connect to local MySQL server through socket
‘/var/lib/mysql/mysql.soc

  Niginx 官方的更新源扩大: vim /etc/yum.repos.d/nginx.repo

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

急需设置 /etc/hosts

     扩充以下内容

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

  [root@123 /] # vim /etc/hosts

[nginx]  name=nginx repo  baseurl=http://nginx.org/packages/centos/6/$basearch/  gpgcheck=0  enabled=1  

yum install nginx  

-DWITH_PARTITION_STORAGE_ENGINE=1 \

  127.0.0.1 localhost localhost.localdomain localhost4
localhost4.localdomain4
  ::1 localhost localhost.localdomain localhost6
localhost6.localdomain6

  优化Nginx配置:  

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1\

保留退出 设置mysql开机自启

#根据CPU核心processes而定  worker_processes 6;  worker_cpu_affinity 000001 000010 000100 001000 010000 100000 ;

  #启用epoll  worker_rlimit_nofile 51200;  events {      worker_connections 51200;      use epoll;  }    #参数调整      sendfile on;      tcp_nopush on;      tcp_nodelay on;      server_tokens off;      keepalive_timeout 50;      server_names_hash_bucket_size 128;      client_header_buffer_size 32k;      large_client_header_buffers 4 32k;      client_max_body_size 50m;    #fastcgi优化      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 256k;    #开启gzip并优化      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;  

-DWITH_READLINE=1\

[root@123 /]# chkconfig --levels 235 mysqld on

  设置开机运营:

-DENABLED_LOCAL_INFILE=1\

 

service nginx start  chkconfig nginx on  

#安装php,php-fpm  yum install php php-fpm php-bcmatch php-gd php-mbstring php-mcrypt php-mysql

-DMYSQL_USER=mysql\

登入MySQL删除空用户,修改root密码

  配置PHP脚本的运营:

-DMYSQL_TCP_PORT=3306\

先是次登入mysql未有设置密码间接    

cp/etc/nginx/conf.d/default.conf etc/nginx/conf.d/default.confbak   vim  /etc/nginx/conf.d/default.conf  

-DMYSQL_UNIX_ADDR=/yourpath/mysql/run/mysql.sock
make && make install
chmod +w /usr/local/mysql/
chown -R mysql.mysql /usr/local/mysql/
cd ..
/your_install_path/mysql/bin/mysql_install_db
–basedir=/your_path/mysql –datadir=/your_path/data –user=mysql

[root@123 /]# mysql

mysql>select user,host,password from mysql.user;

mysql>drop user ''@localhost;
mysql>update mysql.user set password = PASSWORD('你的密码') where user='root';
mysql>flush privileges;

  设置网址的私下认可目录:#此处php-fpm是利用监听端口的主意,同一台机的话最佳利用unix
socket

cp ./support-files/mysql.server /etc/init.d/mysqld
chkconfig –add mysqld
chmod u+x /etc/init.d/mysqld
vi /etc/init.d/mysqld
basedir=
datadir=
更改为:
basedir=/your_path/mysql
datadir=/your_path/data

  

#去除下面这段内容的注释  location ~ \.php$ {      root /home/www;      fastcgi_pass  127.0.0.1:9000;      fastcgi_index index.php;      fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name;      include  fastcgi_params;  }  #注意其中fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径  

conf=/etc/my.cnf
更改为:
conf=/your_conf_path/my.cnf

8:安装php
   

4, vsftpd配置

vi /usr/local/mysql/my.cnf
#日增以下内容
[client]
character-set-server = utf8
port    = 3306
socket  = /tmp/mysql.sock

[root@123 /]# yum install php php-fpm lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap
//安装php和所需组件使PHP支持MySQL、FastCGI模式

[root@123 /]# yum install php-tidy php-common php-devel php-fpm php-mysql    

[root@123 /]# service php-fpm start
[root@123 /]# chkconfig --levels 235 php-fpm on

     先配置iptables , vi /etc/sysconfig/iptables ,复制 –dport
22那行,粘贴改成21端口。保存,重启service iptables restart。 

[mysqld]
character-set-server = utf8
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
user    = mysql
port    = 3306
socket  = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /data0/mysql/3306/data
log-error = /data0/mysql/3306/mysql_error.log
pid-file = /data0/mysql/3306/mysql.pid
open_files_limit    = 10240
back_log = 600
max_connections = 5000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
#thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 3
log-slave-updates
log-bin = /data0/mysql/3306/binlog/binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
relay-log-index = /data0/mysql/3306/relaylog/relaylog
relay-log-info-file = /data0/mysql/3306/relaylog/relaylog
relay-log = /data0/mysql/3306/relaylog/relaylog
expire_logs_days = 30
key_buffer_size = 256M
read_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

  

yum install vsftpd ftp  touch /var/log/vsftpd.log  service vsftpd start  chkconfig vsftpd on  vim /etc/vsftpd/vsftpd.conf  #修改相关参数如下:  #设定不允许匿名访问  anonymous_enable=NO    #设定本地用户可以访问。注:如使用虚拟宿主用户,在该项目设定为NO的情况下所有虚拟用户将无法访问。  local_enable=YES    #使用户不能离开主目录,并制定文件  chroot_list_enable=YES  chroot_list_file=/etc/vsftpd/chroot_list    #设定vsftpd的服务日志保存路径。注意,该文件默认不存在。必须要手动touch出来 ,前面步骤已经创建  xferlog_file=/var/log/vsftpd.log    #允许使用ASCII模式上传和下载  ascii_upload_enable=YES  ascii_download_enable=YES    #PAM认证文件名。PAM将根据/etc/pam.d/vsftpd进行认证  pam_service_name=vsftpd    #以下这些是关于Vsftpd虚拟用户支持的重要CentOS FTP服务配置项目。默认vsftpd.conf中不包含这些设定项目,需要自己手动添加RHEL/CentOS FTP服务配置。    #设定启用虚拟用户功能。  guest_enable=YES    #指定虚拟用户的宿主用户。-RHEL/CentOS中已经有内置的ftp用户了  guest_username=ftp    #设定虚拟用户个人vsftp的RHEL/CentOS FTP服务文件存放路径。存放虚拟用户个性的CentOS FTP服务文件(配置文件名=虚拟用户名)  user_config_dir=/etc/vsftpd/vuser_conf      touch /etc/vsftpd/chroot_list  echo ftp >> /etc/vsftpd/chroot_list    yum install db4 db4-utils  vim /etc/vsftpd/vuser_passwd.txt  加入相应的用户信息,其中奇数行为你新增用户的账号,偶数行为密码,不能有空格  username1  password1  username2  password2    保存文件退出,生成用户认证的db文件  db_load -T -t hash -f /etc/vsftpd/vuser_passwd.txt /etc/vsftpd/vuser_passwd.db  vim /etc/pam.d/vsftpd  用#注释所有的内容,然后增加以下两行内容:  auth required pam_userdb.so db=/etc/vsftpd/vuser_passwd  account required pam_userdb.so db=/etc/vsftpd/vuser_passwd    保存退出。再创建虚拟用户的ftp服务文件夹,以及前文中所增加的账号用户的配置文件  mkdir /etc/vsftpd/vuser_conf/  vim /etc/vsftpd/vuser_conf/username1    填写以下内容:  #username1用户的根目录(自己决定)  local_root=/home/www/ftp  write_enable=YES  anon_umask=0  anon_world_readable_only=NO  anon_upload_enable=YES  anon_mkdir_write_enable=YES  anon_other_write_enable=YES    保存内容,退出。要创建上述配置文件中所设置的用户根目录,并为其设置权限    mkdir /home/www/ftp  chmod 777 /home/www/ftp  service vsftpd restart    ok  

interactive_timeout = 120
wait_timeout = 120

9:配置nginx支持php

  #一时会见世,能够三回九转ftp,却不能够列出目录,这几个是iptable的端口难题。开启PASV就能够,vim
/etc/vsftpd/vsftpd.conf

skip-name-resolve
#master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396

[root@123 /]# mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak    //将配置文件改为备份文件
[root@123 /]# cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf   //由于原配置文件要自己去写因此可以使用默认的配置文件作为配置文件

//修改nginx配置文件,添加fastcgi支持
[root@123 /]# vi /etc/nginx/nginx.conf
  index index.php index.html index.htm;  //加入index.php

  location ~ \.php$ {
      root /home/wwwroot;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
  }

  //说明 $document_root  是php函数定向到root目录
  //将以上代码注释去掉,并修改成nginx默认路径
pasv_enable=YES  pasv_min_port=9000  pasv_max_port=9020

#master-host     =   192.168.1.2
#master-user     =   username
#master-password =   password
#master-port     =  3306

  

 
 然后在iptables里面增多那七个端口,如故前面说的,yy一行22,再p一下,把22改成柒仟:9020;

server-id = 1

10:配置php    

还应该有望是selinux的关机,

innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 512M
innodb_data_file_path = ibdata1:256M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0

[root@123 /]# vi /etc/php.ini  //编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1  

modprobe ip_nat_ftp 

#log-slow-queries = /data0/mysql/3306/slow.log
#long_query_time = 10

11:重启nginx php-fpm

    service iptables restart && service vsftpd restart

[mysqldump]
quick
max_allowed_packet = 32M

[root@123 /]# service nginx restart
[root@123 /]# service php-fpm restart

 

启动MySQL
service mysqld start

  

5,安装Mysql5.6(参照他事他说加以考察那篇文章:

四、安装PHP及扩展

12:建立info.php文件

  安装到位后纪念运维 mysql_security_installation

1、安装php
64人操作系统先拷贝一下LDAP,试行以下命令:
cp /usr/lib64/libldap* /usr/lib/

[root@123 /]# vi /home/wwwroot/info.php
<?php
   phpinfo();
?>

   
 远程连接时,还要将mysql3306端口步入iptables,同样采取前边的措施,复制一句22的,改成3306,重启iptables就能够。

tar jxvf php-5.3.14.tar.bz2 && cd cd php-5.3.14
./configure –prefix=/usr/local/php \
–with-iconv-dir=/usr/local \
–with-freetype-dir \
–with-mysql=/usr/local/mysql \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–with-jpeg-dir \
–with-png-dir \
–with-zlib \
–with-mhash \
–enable-sockets \
–enable-ftp \
–with-libxml-dir \
–enable-xml \
–disable-rpath \
–enable-safe-mode \
–enable-bcmath \
–enable-shmop \
–enable-sysvsem \
–enable-inline-optimization –with-curl \
–with-curlwrappers \
–enable-mbregex \
–enable-mbstring \
–with-mcrypt \
–with-gd \
–enable-gd-native-ttf \
–with-openssl \
–with-mhash \
–enable-pcntl \
–enable-sockets \
–with-ldap \
–with-ldap-sasl \
–enable-fpm \
–with-xmlrpc \
–enable-zip \
–enable-soap \
–without-pear

  

      配置mysql远程连接:命令行使用root登入

make ZEND_EXTRA_LIBS=’-liconv’
make install
cp php.ini-production /usr/local/php/etc/php.ini

    

mysql -uroot -p  use mysql;  update user set host = '%' where user = 'root';  

2、安装PHP扩大模块
wget
tar zxvf memcache-2.2.5.tgz && cd memcache-2.2.5
/usr/local/php/bin/phpize
./configure – –with-php-config=/usr/local/php/bin/php-config
make && make install
cd ../

13:测量检验nginx是不是解析php
    本地浏览器输入:服务器ip地址/phpinfo.php
    彰显php分界面 情形搭建成功

  

wget 
tar jxvf eaccelerator-0.9.6.1.tar.bz2 && cd eaccelerator-0.9.6.1
/usr/local/php/bin/phpize
./configure –enable-eaccelerator=shared
–with-php-config=/usr/local/php/bin/php-config
make && make install
cd ../

 

 

wget
tar zxvf PDO_MYSQL-1.0.2.tgz && cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
–with-pdo-mysql=/usr/local/mysql
make && make install
cd ../

如上内容仿照效法多位大神博客,在使用进程中出现有的报错举行调弄整理后举行整治,如有雷同请见谅

 

#先安装perl-CPAN,为幸免出现以下错误:
yum -y install yum -y install perl-CPAN
荒唐如下:
perl /usr/lib/perl5 /usr/share/perl5 .) at Makefile.PL line 24.
BEGIN failed–compilation aborted at Makefile.PL line 24.
make[1]: *** [PerlMagick/Makefile] 错误 2
make[1]: Leaving directory `/data0/software/ImageMagick-6.5.1-2′
make: *** [all] 错误 2

 


wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz && cd ImageMagick-6.5.1-2
./configure
make && make install
cd ../

其他或许的劳作: 

wget
tar zxvf imagick-3.1.0.tgz && cd imagick-3.1.0
/usr/local/php/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config
make && make install
cd ../

  • 安装phpMyAdmin

3、修改php.ini文件

  1. google
    phpMyAdmin找到在sourceforge的地址,然后在网址根目录下wget下来。
  2. 解压,重命名目录,踏入目录,cp config.sample.inc.php config.inc.php 
  3. 重启nginx
  4. 留神这里还得再改一下,浏览器步向phpmyadmin地址,或然会冒出上边包车型大巴不当:

    Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.
    

    急需将/var/lib/php/session的持有者改为nginx  

    chown -R nginx:nginx /var/lib/php/session
    

sed -i ‘s#extension_dir = “./”#extension_dir =
“/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/”\nextension
= “memcache.so”\nextension = “pdo_mysql.so”\nextension =
“imagick.so”\n#’ /usr/local/php/etc/php.ini
sed -i ‘s#output_buffering = Off#output_buffering = On#’
/usr/local/php/etc/php.ini
sed -i “s#; always_populate_raw_post_data =
On#always_populate_raw_post_data = On#g”
/usr/local/php/etc/php.ini
sed -i “s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g”
/usr/local/php/etc/php.ini

 以后应有能够访谈了…

4、配置eAccelerator加速
mkdir /your/path/
vi /usr/local/php/etc/php.ini
在最终扩充以下内容:
[eaccelerator]
zend_extension=”/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so”
eaccelerator.shm_size=”64″
eaccelerator.cache_dir=”/data0/mysql/3306/eaccelerator_cache”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”3600″
eaccelerator.shm_prune_period=”3600″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

  • 计划mysql远程连接

    因为管理亟待,大家须要长途连接一下mysql,以开展保管。安装好phpmyadmin后,在客商那里能够选拔新建四个客户,将主机设置为须求连接的主机ip或自由主机就可以

5、缔造客户及组和虚构目录
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
mkdir /data0/www/html -p
chmod +w /data0/www/html/ && chown www.www /data0/www/html/ -R

 

cp /usr/local/php/etc/php-fpm.conf.default
/usr/local/php/etc/php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
去掉上面包车型大巴注释
pm.max_children = 64
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 1024
user = www
group = www

 

测试
/usr/local/php/sbin/php-fpm -t
如出现以下就代表成功
NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is
successful
启动
/usr/local/php/sbin/php-fpm &

 

五、安装Nginx

  • 机关挂载硬盘:

    出于外置了八个硬盘,所以得配置开机自动挂载。vim /etc/fstab加入:

    /dev/sdc /mnt/data auto defaults 0 0

1、安装pcre
wget

tar zxvf pcre-8.10.tar.gz && cd pcre-8.10
./configure
make && make install
cd ..

wget
tar zxvf nginx-0.8.46.tar.gz && cd nginx-0.8.46
./configure –user=www –group=www –prefix=/usr/local/nginx
–with-http_stub_status_module –with-http_ssl_module
make && make install
cd ../
创设日志寄放目录
mkdir /data0/logs
chmod +w /data0/logs/ && chown www.www /data0/logs/
vi /usr/local/nginx/conf/nginx.conf
#追加以下内容
user  www www;

  • centos网络铺排:

    IP设置 : /etc/sysconfig/network-scripts/ifcfg-eth0

    网关设置: /etc/sysconfig/network**

    DNS设置: /etc/resolv.conf**

    重启网络:service network restart 


  •  关闭SELiinux

    在后边的做事中,发现众多地点不便于,举个例子ftp不可能上传等主题素材,ssh远程不能够连接等,于是关闭SELinux,运营以下命令:

    #/usr/sbin/setenforce 0  #echo "usr/sbin/setenforce 0" >> /etc/rc.local
    

    那样就能够把关闭SELinux参加开机运维。

worker_processes 8;


error_log  /data0/logs/nginx_error.log  crit;

 

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


#Specifies the value for maximum file descriptors that can be opened by
this process.
worker_rlimit_nofile 65535;

events
{
  use epoll;
  worker_connections 65535;
}

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;
  client_max_body_size 8m;

  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  test.com;
    index index.html index.htm index.php;
    root  /data0/www/html;

    #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;
      include fcgi.conf;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }

    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }

    log_format  access  ‘$remote_addr – $remote_user [$time_local]
“$request” ‘
              ‘$status $body_bytes_sent “$http_referer” ‘
              ‘”$http_user_agent” $http_x_forwarded_for’;
    access_log  /data0/logs/access.log  access;
      }

  server
  {
    listen  80;
    server_name  status.test.com;

    location / {
    stub_status on;
    access_log   off;
    }
  }
}

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;

启动Nginx
/usr/local/nginx/sbin/nginx
加上到自运营
/usr/local/nginx/sbin/nginx
/usr/local/php/sbin/php-fpm

六、优化内核

vi /etc/sysctl.conf
#################################################################
#
#优化内核参数
#
#################################################################
# 扩展以下:
##各类互连网接口接收数据包的速率比内核管理这个包的进程快时,允许送到行列的数据包的最大数量;
net.core.netdev_max_backlog =  32768

#web应用中linten函数的backlog暗许会给大家根本参数的net.core.somaxconn限制到128,而nginx定义的
#NGX_LISTEN_BACKLOG默感觉511,所以有不可缺少调节那几个值;
net.core.somaxconn = 32768

net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216

#岁月戳能够幸免系列号的卷绕.多个1Gbps的链路料定会赶过从前用过的行列号.时间戳能够让内核接受这种”格外”
#的多寡包.这里须求将其关掉.
net.ipv4.tcp_timestamps = 0

#为了开发对端的连接,内核供给发送二个SYN并顺便七个回答前者SYN的ACK,也正是叁回握手中的第一遍握手
#,那么些装置决定了基础放弃连接在此以前发送SYN+ACK包的数目;
net.ipv4.tcp_synack_retries = 2

#在根本放弃组建在此之前发送SYN包数量;
net.ipv4.tcp_syn_retries = 2

#当出现SYN等待队列溢出时,启用cookies来拍卖,可防范一些些SYN攻击,暗许为0,表示关闭;
net.ipv4.tcp_syncookies = 1

#开启TCP连接中TIME_WAIT scokets的火速回收,默以为0,表示关闭;
net.ipv4.tcp_tw_recycle = 1

#net.ipv4.tcp_tw_len = 1

#允许TIME-WAIT sockets重新用于新的TCP连接,默感到0,表示关闭;
net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800

#系统暗中同意的TIMEOUT时间;
#net.ipv4.tcp_fin_timeout = 30
#当keeplive起用的时候,TCP发送keeplive音讯的频度.缺省2钟头,能够变动为2分钟;
#net.ipv4.tcp_keepalive_time = 1200

#表示用于向外接连的端口范围,缺省32768–61000,改为1024–6四千
net.ipv4.ip_local_port_range = 1024  65535

#代表SYN队列的尺寸,暗中认可1024,加大到65536,可容纳更加的多等待连接的网络连接数;
net.ipv4.tcp_max_syn_backlog = 65536

#系统同有的时候间保持TIME_WAIT的最大额,假使当先这一个数字,TIME_WAIT将即时被铲除并打字与印刷警告音讯,
#暗中同意1九千0,现改动为五千,对于Apache、Nginx等服务器,上几行的参数可以很好地裁减TIME_WAIT套接字数量,但
#对于Squid,效果并非常的小.此项参数能够调整TIME_WAIT的最大数量,防止Squid服务器被大批量的TIME_
#WAIT拖死;
net.ipv4.tcp_max_tw_buckets = 5000

vi /etc/security/limits.conf
#追加以下内容
*       soft    nofile  65536
*       hard    nofile  65536


相关文章