[centos]apache、php構成


  • apache yum -y install httpd apr apr-util httpd-manual mod_ssl mod_perl mod_auth_mysql httpd-devel
  • を取り付ける
  • apache systemctl start httpd.serviceまたはservice httpd start
  • を起動する.
  • apacheマルチポートリスニング
  • apacheプロファイルvi /etc/httpd/conf/httpd.conf
  • を編集
  • はListen 80を見つける、その下にListen 8080
  • を追加する.
  • 保存終了
  • apache systemctl restart httpd.serviceまたはservice httpd restart
  • を再起動する.
  • サイト仮想ディレクトリとマルチサイト構成の設定
  • /etc/httpd/conf/httpd.confドキュメントには、次のコマンドが表示されます.IncludeOptional conf.d/*.confこの言葉の意味は/etc/http/conf.d/ディレクトリの下ですべての接尾辞が.confのファイルが含まれます.so/etc/http/conf.d/ディレクトリに複数追加するだけです.confファイルでいいです
  • vi /etc/httpd/conf.d/test1.conf
    NameVirtualHost *:80 #    ,     
    80>
    ServerAdmin test@test.com #            
    ServerName test1.cn #  
    DocumentRoot "/var/www/test1" #     
    ServerAlias www.test1.cn blog.test1.cn #        
    
  • は、/etc/httpd/conf.d/test1.confファイルに他のサイト(シングルポートマルチドメイン名設定)
    
    ServerAdmin [email protected]
    DocumentRoot /var/www/test2
    ServerName blog.test.com
    
  • を追加することもできる.
  • apacheサーバsystemctl restart httpd.serviceまたはservice httpd restart
  • を再起動する.
  • libmcrypt拡張子のインストール
  • wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
  • tar -zxvf libmcrypt-2.5.7.tar.gz
  • cd libmcrypt-2.5.7
  • ./configure
  • make && make install
  • echo "/usr/local/lib" >> /etc/ld.so.conf#centos環境変数(ld)に拡張子を追加する
  • ldconfig

  • php 7ダウンロードアドレスのコンパイルインストール
  • wget http://124.202.164.13/files/425300000A4693F4/cn2.php.net/distributions/php-7.1.6.tar.gz
  • tar -zxvf php-7.1.6.tar.gz
  • コンパイルインストール./configure --prefix=/etc/php7 --with-apxs2=/usr/bin/apxs #apxs , whereis apxs ( , ) --exec-prefix=/etc/php7 --bindir=/etc/php7/bin --sbindir=/etc/php7/sbin --includedir=/etc/php7/include --libdir=/etc/php7/lib/php --mandir=/etc/php7/php/man --with-config-file-path=/etc/php7/etc --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mcrypt=/usr/local/libmcrypt --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --with-opcache --with-redis --enable-fpm --enable-fastcgi --with-fpm-user=www --with-fpm-group=www --without-gdbm --disable-fileinfo
  • cd /etc/php7/bin/
  • cp phar.phar /usr/bin/phar.phar cp php /usr/bin/php cp php-cgi /usr/bin/php-cgi cp php-config /usr/bin/php-config cp phpize /usr/bin/phpize cp /etc/php7/sbin/php-fpm /usr/bin/php-fpm cd /etc/php7/etc/ cp php-fpm.conf.default php-fpm.conf cp cp php-fpm.d/www.conf.default php-fpm.d/www.conf
  • php 7ソースディレクトリcp php.ini-development /etc/php7/etc/php.ini
  • に入る
  • groupadd www && useradd www -g www



  • apache実行phpファイルの構成
  • vi /etc/httpd/conf/httpd.conf
  • AddTypeキーワード増加AddType application/x-httpd-php .php .phtml
  • を見つける
  • LoadModuleキーワードを見つけるLoadModule php7_module /usr/lib64/httpd/modules/libphp7.so
  • 増加
  • 保存終了httpd service httpd restart
  • 再起動