网卡在/etc/sysconfig/network-scripts/底下。
添加:
BOOTPROTO=static
IPADDR=10.1.3.43
NETMASK=255.255.255.0
GATEWAY=10.1.1.254
DNS=114.114.114.114
NM_CONTROLLED=no
……
ONBOOT=yes
service network restart
vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
setenforce 0
systemctl stop firewalld.service
systemctl disable firewalld.service
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum search nginx
yum install -y nginx
systemctl start nginx.service
systemctl enable nginx.service
mkdir /home/www
mkdir /home/www/gz_news
mkdir /home/logs/
vi /etc/nginx/nginx.conf
在http的花括弧内,include /etc/nginx/conf.d/*.conf;之后加入:
server {
listen 80 default;
server_name app.gzrb.com;
root /home/www/gz_news;
charset utf-8;
access_log /home/logs/host.access.log main;
location / {
root /home/www/gz_news;
index index.php index.html index.htm;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
}
location ~* /download/ {
root /home/www/gz_news;
}
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {
root /home/www/gz_news;
expires 7d;
}
location /nginx_status {
stub_status on;
access_log off;
allow 192.168.10.0/24;
deny all;
}
location ~ ^/(WEB-INF)/ {
deny all;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
root /home/www/gz_news;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
yum -y install epel-release
(yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm)
yum -y install libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel gd
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum-config-manager --enable remi-php74
如果遇见错误
CRITICAL:yum.cli:Config error: Error accessing file for config file:///root/onfig-manage
这是yum源出问题了。则启用下面的命令:
yum search php74
yum install php74-* --skip-broken
vi /etc/rc.local
/opt/remi/php74/root/usr/sbin/php-fpm
chmod 755 /etc/rc.d/rc.local
nginx -t
nginx -s stop
systemctl start nginx.service
nginx -s reload
/opt/remi/php74/root/usr/sbin/php-fpm
重启php-fpm
kill -USR2 `cat /var/opt/remi/php74/run/php-fpm/php-fpm.pid`
星期四, 08/13/2020 - 16:37 — 杨超