本文共 1364 字,大约阅读时间需要 4 分钟。
#防火墙允许端口iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPTiptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT#SELinux配置SELINUX=disabled#Nginx安装yum -y remove httpd* php*yum -y install nginxservice nginx startchkconfig nginx on#MySQL安装yum -y install mysql mysql-serverservice mysqld startchkconfig mysql oncp /usr/share/mysql/my-medium.cnf /etc/my.cnfmysql_secure_installationservice mysqld restart#php安装yum -y install php php-fpm php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath libmcrypchkconfig php-fpm onservice php-fpm start#Nginx配置cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bakcp /etc/nginx/nginx.conf.default /etc/nginx/nginx.confindex index.html index.htm index.phpfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;#取消FastCGI server 部分location 的注释,并要注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name 或者使用绝对路径#PHP配置vim /etc/php.inidate.timezone = PRC #946行,设置时区expose_php = Off #432行,禁止php版本short_open_tag = On #229行,支持php短标签#php-fpm配置cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.bakuser = nginxgroup = nginxchown nginx.nginx /usr/share/nginx/html/ -R #创建测试页vim /usr/share/nginx/html/index.php rm -rf /usr/share/nginx/html/index.html #删除原有的html页面#浏览器访问测试
转载于:https://blog.51cto.com/shanqiangwu/1635754