yum install -y epel-release yum-utils
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm yum-config-manager --disable remi-php54 yum-config-manager --enable remi-php73
vi /etc/yum.repos.d/nginx.repo
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enabled=1
yum install -y nginx
yum install -y php-fpm php
vi /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.3 CentOS repository list - created 2019-01-25 13:04 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
yum install -y MariaDB-server
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --reload
systemctl restart nginx systemctl enable nginx
vi /etc/nginx/conf.d/default.conf
server { listen 80; server_name localhost; gzip on; gzip_comp_level 5; gzip_min_length 256; gzip_proxied any; gzip_vary on; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # text/html is always compressed by gzip module location ~* \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ { expires 7d; } charset utf-8; access_log /var/log/nginx/access.log main; root /var/www/html; index index.php index.html index.htm; location / { try_files $uri $uri/ =404; } error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
chcon -R -t httpd_sys_rw_content_t /usr/share/nginx/html systemctl reload nginx
vi /etc/php.ini
: ;cgi.fix_pathinfo=1 cgi.fix_pathinfo=0 : [Date] : date.timezone = Asia/Taipei :
vi /etc/php-fpm.d/www.conf
: ; RPM: apache user chosen to provide access to the same directories as httpd ;user = apache user = nginx ; RPM: Keep a group allowed to write in log dir. ;group = apache group = nginx : : ; Default Values: user and group are set as the running user ; mode is set to 0660 listen.owner = nobody listen.group = nobody ;listen.mode = 0660 :
systemctl restart php-fpm systemctl enable php-fpm
systemctl restart mariadb systemctl enable mariadb mysql_secure_installation mysql -u root -p
yum install php-mysqlnd php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-zip php-curl php-cli systemctl restart php-fpm systemctl restart nginx
yum install wget unzip cd /var/www/html/ wget http://wordpress.org/latest.zip unzip latest.zip chown -R nginx:nginx wordpress
mysql -u root -p
create database `wordpress`; create user 'wpadmin'@'localhost' identified by '**Password**'; grant all on wordpress.* to 'wpadmin'@'localhost'; flush privileges; quit
: index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$args; } error_page 404 /404.html; :
nginx -t systemctl restart nginx
: location / { try_files $uri $uri/ /index.php?$args; } location /wp-admin/ { allow 10.0.0.0/8; allow 172.16.0.0/16; deny all; } location /wp-admin/admin-ajax.php { allow all; } error_page 404 /404.html; :
systemctl restart nginx