sudo yum updatejavascript
sudo yum install wgetphp
阿里雲默認使用了本身的鏡像源。
不是阿里雲鬚要下載對應當前系統版本的nginx包
創建nginx的yum倉庫(默認yum是沒有nginx的)
複製代碼
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpmcss
sudo rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpmhtml
開始安裝Nginxjava
sudo yum install -y nginxmysql
Nginx啓動nginx
sudo systemctl start nginxweb
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmsql
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmcentos
sudo yum install -y php70w
sudo yum install -y php70w-mysql.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64
sudo yum install -y php70w-fpm
sudo systemctl start php-fpm
systemctl status php-fpm
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
sudo yum install -y mysql-server
sudo chown -R root:root /var/lib/mysql
sudo systemctl restart mysql
mysql -u root
mysql > use mysql;
mysql > update user set password=password('password') where user='root';
mysql > flush privileges;
mysql > exit;
mysql -u root -p
mysql > use mysql;
mysql > grant all privileges on
*.*
to root@'%' identified by 'password' with grant option;
mysql >flush privileges
拷貝一份默認配置。參考下面的server
cp nginx.conf /conf.d xxx.cong
server{
listen 80;
root /usr/share/nginx/html;
index index.html index.php index.htm;
# Make site accessible from http://localhost/
server_name localhost;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 5;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
charset UTF-8;
location ~* .(jpg|jpeg|png|gif|css|js|swf|mp3|avi|flv|xml|zip|rar)$ {
gzip on;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
複製代碼
重啓Ngix和php-fpm、配置完畢。