服务器基于centos7.4(x64)系统搭建。安装的主要程序有:NGINX1.12.1PHP7.1.10MySQL5.7Node.js8.8.1环境准备yum-yupdate#系统版本和内核升级yum-yinstallgccgcc-c++makepcrepcre-develzlibzlib-developensslopenssl-devellibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-develcurlcurl-devellibxslt-devellibevent-develunzipzip#类库安装常用命令:lsb_release-a#查看系统版本NGINX安装(源码)代码)wgethttp://nginx.org/download/nginx-1.12.1.tar.gztarzxvfnginx-1.12.1.tar.gzcdnginx-1.12.1./configure--prefix=/www--with-http_ssl_module--with-stream--with-http_v2_module#配置NGINXmake&&makeinstall#编译安装cp/www/sbin/nginx/bin/nginx#nginx相关操作nginx#启动nginx-sreload|stop#重启/停止修改NGINX配置文件(/www/conf/nginx.conf),启用网站压缩,重定向HTTPSworker_processes1;events{worker_connections1024;}http{includemime.types;default_type应用程序/八位字节流;发送文件;keepalive_timeout65;#打开网站压缩gzipon;gzip_min_length1k;gzip_buffers416k;gzip_comp_level3;gzip_types文本/普通应用程序/x-javascript文本/css应用程序/xml文本/javascript应用程序/x-httpd-php图像/jpeg图像/gif图像/png;gzip_vary关闭;gzip_disable"MSIE[1-6]\.";服务器{听80;server_name***.comwww.***.com;#填写绑定证书的域名rewrite^(.*)https://$host$1permanent;#http重定向https}服务器{听443;server_namewww.***.com***.com;#填写绑定证书sslon的域名;ssl_certificatecert/1_cinglong.com_bundle.crt;ssl_certificate_key证书/2_cinglong。com.密钥;ssl_session_timeout5m;ssl_protocolsTLSv1TLSv1.1TLSv1.2;#根据这个协议配置ssl_ciphersECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#根据这个套件配置ssl_prefer_server_cipherson;位置/{根html;indexindex.phpindex.htmlindex.htm;}位置~*\.php${fastcgi_indexindex.php;fastcgi_pass127.0.0.1:9000;包括fastcgi_params;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;fastcgi_paramSCRIPT_NAME$fastcgi_script_name;client_max_body_size50m;}}}相关网站:NGINX:http://nginx.org/PHP安装(源码)#下载并安装PHPcd../#返回根目录wgethttp://cn2.php.net/distributions/php-7.1.10.tar.gztarzxvfphp-7.1.10.tar.gzcdphp-7.1.10./configure--prefix=/php--with-curl--with-mysqli--with-gd--with-freetype-dir--with-pdo-mysql--with-zlib--enable-shmop--with-gettext--with-pdo-sqlite--with-pear--with-iconv-dir--with-openssl--with-libxml-dir--with-xmlrpc--with-xsl--with-png-dir--enable-gd-native-ttf--enable-fpm--enable-mbstring--enable-libxml--enable-xml--enable-gd-native-ttf--enable-bcmath--enable-pdo--disable-fileinfo--enable-pcntl--enable-mbregex--enable-opcache--enable-zip--enable-sockets--with-jpeg-dir=DIRmake&&makeinstall#配置文件cpphp.ini-development/php/lib/php.inicp/php/etc/php-fpm.conf.default/php/etc/php-fpm.confcp/php/etc/php-fpm.d/www.conf.default/php/etc/php-fpm.d/www.confcpsapi/fpm/php-fpm/usr/local/bincp/usr/local/bin/php-fpm/bin/php-fpm#PHP相关操作php-fpm#启动killallphp-fpm#停止修改PHP配置(/php/lib/php.ini),打开opacheopcache.memory_consumption=128opcache.interned_strings_buffer=8opcache.max_accelerated_files=4000opcache.revalidate_freq=60opcache.fast_shutdown=1opcache.enable_cli=1zend_extension=/php/lib/php/extensions/no-debug-non-zts-20160303/opcache.so相关网站:PHPhttp:///php.net/MySQL安装(yum)cd../wgethttp://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpmrpm-ivhmysql57-community-release-el7-11.noarch.rpmyum-yinstallmysql-community-serverservicemysqldstart#启动MySQL#更改密码grep'temporarypassword'/var/log/mysqld.log#获取自动生成的密码mysql-uroot-p#使用上一步获取登录密码ALTERUSER'root'@'localhost'由'***'识别;#更改MySQL密码退出;相关网站:MySQL:http://dev.mysql.com/download...Node.js安装(官方编译版)cd../wgethttps://nodejs.org/dist/v8.8.1/node-v8.8.1-linux-x64.tar.xz#下载xz-dnode-v8.8.1-linux-x64.tar.xztar-xvfnode-v8.8.1-linux-x64.tar#unzipmvnode-v8.8.1-linux-x64/usr/local/node#locationtransfervim~/.bash_profile#findPATH=$PATH:$HOME/bin,在(:/usr/local/node/bin)后面添加路径source~/.bash_profile#reloadnode-v#Version查看相关网站:MySQL:https://nodejs.org/en/downloa...
