2018年3月12日 14:09:39php
注意時效html
centos7 網卡 cd /etc/sysconfig/network-scripts/ TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens160 UUID=90a09195-c24e-401d-bf4e-8c846539b130 DEVICE=ens160 ONBOOT=yes IPADDR=172.17.1.253 GATEWAY=172.17.1.1 NETMASK=255.255.255.255 DNS1=8.8.8.8 DNS2-172.17.1.1 關閉firewall systemctl stop firewalld.service #中止firewall systemctl disable firewalld.service #禁止firewall開機啓動 yum install -y apr* autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libxml* libtiff libtiff* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget zlib-devel yum -y groupinstall "Development Tools" yum install -y gcc gcc-c++ make cmake automake autoconf gd file bison patch mlocate flex \ diffutils zlib zlib-devel pcre pcre-devel \ libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \ glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \ ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel \ krb5 krb5-devel openssl openssl-devel \ openldap openldap-devel nss_ldap openldap-clients openldap-servers \ openldap-devellibxslt-devel kernel-devel libtool-libs \ readline-devel gettext-devel libcap-devel php-mcrypt libmcrypt libmcrypt-devel recode-devel yum install -y libxml2 libxml2* openssl-dev libcurl3-openssl-dev openssl-devel.i686 \ openssl-perl.i686 libcurl-devel.i686 libjpeg-turbo-devel.i686 libpng.i686 libpng-devel.i686l freetype-devel php-gd yum -y install cmake ncurses ncurses-devel bison bison-devel boost boost-devel 安裝MySQL groupadd mysql #添加mysql組 useradd -g mysql mysql -s /bin/false #建立用戶mysql並加入到mysql組,不容許mysql用戶直接登陸系統 mkdir -p /data/mysql #建立MySQL數據庫存放目錄 chown -R mysql:mysql /data/mysql #設置MySQL數據庫存放目錄權限 mkdir -p /usr/local/mysql #建立MySQL安裝目錄 mkdir -p /usr/local/boost cd /usr/local/boost wget http://www.sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz tar -xvzf boost_1_59_0.tar.gz 編譯 cmake \ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DMYSQL_USER=mysql \ -DWITH_DEBUG=0 \ -DWITH_SSL=system \ -DWITH_BOOST=/usr/local/boost pid =/www/lanmps/php5.6.31/var/run/php-fpm.pid error_log = /www/lanmps/php5.6.31/var/log/php-fpm.log log_level = notice [www] listen = /tmp/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www listen.group = www listen.mode = 0666 user = www group = www pm = dynamic pm.max_children = 80 pm.start_servers = 40 pm.min_spare_servers = 40 pm.max_spare_servers = 80 request_terminate_timeout = 100 request_slowlog_timeout = 0 slowlog = var/log/slow.log #修改/usr/local/mysql權限 chmod +w /usr/local/mysql chown -R mysql:mysql /usr/local/mysql mv /etc/my.cnf /etc/my.cnf.bak cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #拷貝mysql安裝目錄下support-files服務腳本到init.d目錄 cp support-files/mysql.server /etc/rc.d/init.d/mysqld #賦予權限 chmod +x /etc/rc.d/init.d/mysqld #設置開機啓動 chkconfig mysqld on #執行初始化配置腳本,建立系統自帶的數據庫和表,注意配置文件的路徑 ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 確保/usr/local/mysql/data爲空 ./bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data vi /etc/my.cnf [mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data socket=/tmp/mysql.sock symbolic-links=0 [mysqld_safe] ;log-error=/var/log/mariadb/mariadb.log pid-file=/usr/local/mysql/data/localhost.localdomain.pid #修改/etc/profile文件 vi /etc/profile #在文件末尾添加 PATH=/usr/local/mysql/bin:$PATH export PATH #讓配置當即生效 source /etc/profile /usr/local/mysql/bin/mysqladmin -uroot -p password 'root'; /usr/local/mysql/bin/mysqladmin -uroot -p password 'root'; flush privileges; 從新受權用戶 mysqld --skip-grant-tables 回車 --skip-grant-tables 的意思是啓動MySQL服務的時候跳過權限表認證 GRANT ALL PRIVILEGES ON *.* TO 'zx'@'%'IDENTIFIED BY 'zx' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY 'root' WITH GRANT OPTION; nginx安裝 yum -y install yasm libmcrypt libvpx tiff libpng freetype jpeg libgd t1lib ./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module vi /etc/init.d/nginx chmod +x /etc/init.d/nginx chkconfig nginx on ./configure \ --prefix=/usr/local/nginx \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --http-client-body-temp-path=/var/cache/nginx/client_temp \ --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ --user=www \ --group=www \ --with-pcre \ --with-http_v2_module \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_auth_request_module \ --with-mail \ --with-mail_ssl_module \ --with-file-aio \ --with-ipv6 \ --with-http_v2_module \ --with-threads \ --with-stream \ --with-stream_ssl_module yum -y install libicu-devel make[2]: *** [progname.o] 錯誤 1 make[2]:正在離開目錄 `/home/lmos/libiconv-1.14/srclib' make[1]: *** [all] 錯誤 2 make[1]:正在離開目錄 `/home/lmos/libiconv-1.14/srclib' make: *** [all] 錯誤 2 進入srclib目錄 執行 sed -i -e '/gets is a security/d' ./stdio.in.h Cannot find ldap.h 複製代碼 代碼以下: yum -y install openldap yum -y install openldap-devel configure: error: Cannot find ldap libraries in /usr/lib 複製代碼 代碼以下: cp -frp /usr/lib64/libldap* /usr/lib/ http://www.bkjia.com/PHPjc/1008013.html 參考bug解決辦法 yum install -y epel-release yum install -y libmcrypt-devel export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH ./configure --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --with-mysql-sock=/tmp/mysql.sock \ --enable-fpm \ --with-fpm-user=www \ --with-fpm-group=www \ --enable-mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-mysqlnd-compression-support \ --with-iconv-dir \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir \ --enable-xml \ --disable-rpath \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --enable-mbregex \ --enable-mbstring \ --enable-intl \ --with-mcrypt \ --with-libmbfl \ --enable-ftp \ --with-gd \ --enable-gd-jis-conv \ --enable-gd-native-ttf \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-zip \ --enable-soap \ --with-gettext \ --enable-fileinfo \ --enable-opcache \ --with-pear \ --enable-maintainer-zts \ --with-ldap=shared \ --without-gdbm nodejs curl --silent --location https://rpm.nodesource.com/setup_8.x | bash - 8是版本系列 yum install -y nodejs npm install -g cnpm --registry=https://registry.npm.taobao.org
注意fpm版本也就是php版本
nginx使用sock形式調用php-fpm
vi /etc/php-fpm.d/www.conf
listen = /tmp/php-fpm.sock 建議放在這個目錄,不容易有權限問題,也要主要有沒有按期清理tmp的腳本或者代碼
vi /etc/nginx/conf.d/default.conf
fastcgi_pass unix:/tmp/php-fpm.sock;
注意可不是就這麼就完了
還有須要配置的
listen.owner = www
listen.group = www
listen.mode = 0660
node
listen.allowed_clients = 127.0.0.1mysql
listen = /tmp/php-fpm.socklinux
listen.backlog = -1nginx
nginx 作服務的腳本是有問題的請參看c++
http://bbs.qcloud.com/thread-10429-1-1.html
vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.targetweb
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=truesql
[Install]
WantedBy=multi-user.target數據庫
其實版本差距不大,就是centos的系統操做有寫區別,其餘沒什麼