Centos7 nginx mysql php
# 查看版本号
cat /etc/redhat-release
#1. 安装工具
yum install -y make apr* autoconf cmake automake curl-devel gcc gcc-c++ openssl openssl-devel pcre-devel gd kernel keyutils perl kernel-headers mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* ncurses* libtool* libxml2 libxml2-devel patch bzip2-devel telnet jasper-devel libtiff-devel gtk+-devel wget
#2. 安装php
yum install -y php php-common php-devel php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash php-fpm php-json* php-soap php-process
php -v
php --ini
curl -Ss http://www.workerman.net/check.php | php
yum install libevent-devel -y
pecl install event
echo extension=event.so > /etc/php.d/30-event.ini
systemctl enable php-fpm.service
systemctl start php-fpm.service
#3. 安装nginx
wget http://tengine.taobao.org/download/tengine-2.2.1.tar.gz
tar -zxf tengine-2.2.1.tar.gz
cd tengine-2.2.1
./configure
make
make install
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -s reload
#4. 安装mysql
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
systemctl start mysqld.service
systemctl enable mysqld.service
#mysqladmin password
安装mariadb,代替mysql
yum install mariadb-server.x86_64
systemctl enable mariadb.service
systemctl start mariadb.service
grant all privileges on *.* to 'root'@'%' identified by 'password';
flush privileges;
#5.允许ssh密码登录
vi /etc/ssh/sshd_config
systemctl restart sshd.service
#6. 关闭selinux
vim /etc/selinux/config
修改为:SELINUX=disabled
#7. 防火墙修改
#启动防火墙
systemctl enable firewalld.service
#添加
firewall-cmd --zone=public --add-port=10000/tcp --permanent
firewall-cmd --zone=public --add-port=8282/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=9990/tcp --permanent
systemctl restart firewalld.service
#查看
firewall-cmd --list-ports
Ubuntu 16.04 apach2 php7 mysql
sudo apt install php php-dev php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mcrypt libmcrypt4 libmcrypt-dev php-fpm php-json php-json-patch php-json-schema php-soap php-curl
sudo apt install apache2
cd /etc/apache2/mods-enabled
ln -sf ../mods-available/rewrite.load rewrite.load
vi /etc/apche2/apache2.conf
修改为以下部分为:
<Directory />
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>