一、安装Apache、PHP、Mysql、连接Mysql数据库的包:
yum install httpd yum -y install php yum -y install php-fpm yum -y install mysql yum -y install mysql-server yum -y install php-mysql其中需要输入Y回车,最后 Complete! 除了mysql-server其他都安装成功! 查找原因是因为CentOS 7版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替了。官网下载mysql-server,然后安装。
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然后需要确定,输入Y回车即可。 二、安装常用扩展包 安装Apache扩展包
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql安装PHP扩展包
yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel安装Mysql扩展包
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql配置Apache、mysql开机启动
chkconfig httpd on chkconfig mysqld on重启Apache、mysql服务
service mysqld restart service php-fpm start service httpd restart三、开启mysql 远程访问 3306 默认没有密码 直接回车
mysql -u root -p USE mysql; UPDATE user SET password=password("你的密码") WHERE user='root'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION; flush privileges; exit;在云服务器后台需要打开 3306端口、80端口、443端口。
三、安装VSFTP、并配置
yum -y install vsftpd然后 配置 修改 vsftpd.conf文件
vi /etc/vsftpd/vsftpd.conf # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. #ls_recurse_enable=YES # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=YES **(有些是ON,需要改为YES)** # # This directive enables listening on IPv6 sockets. By default, listening # on the IPv6 "any" address (::) will accept connections from both IPv6 # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6 # sockets. If you want that (perhaps because you want to listen on specific # addresses) then you must run two copies of vsftpd with two configuration # files. # Make sure, that one of the listen options is commented !! # listen_ipv6=YES **(不支持IPV6,一定要注释掉,不然会报错)** pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES userlist_deny=NO **(这里要改为NO,默认是YES)** local_root=/var/www/html use_localtime=YES增加FTP帐户
useradd lee -s /sbin/nologin passwd lee编辑user_list文件,允许lee用户访问FTP
# vsftpd userlist # If userlist_deny=NO, only allow users in this file # If userlist_deny=YES (default), never allow users in this file, and # do not even prompt for a password. # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers # for users that are denied. root bin daemon adm lp sync shutdown halt mail news uucp operator games nobody lee目录设置访问权限
chmod -R 777 /var/www/html开启vsftpd服务
service vsftpd start默认开启vsftp服务
chkconfig vsftpd on四、Apache开启 .htaccess 在etc/httpd/conf/httpd.conf下找到Include conf.modules.d/*.conf,在这句话下添加LoadModule rewrite_module modules/mod_rewrite.so
vi etc/httpd/conf/httpd.conf2、在站点配置文件中添加以下配置:
<Directory /var/www/html> AllowOverride all </Directory>4、重启httpd服务,
systemctl restart httpd未完待续。。。