yum install nginx mariadb-server mariadb php php-mysql php-fpm
systemctl start nginx
systemctl enable nginx
nano /etc/php.ini
cgi.fix_pathinfo=0
nano /etc/php-fpm.d/www.conf
user = nginx
group = nginx
systemctl start php-fpm
systemctl enable php-fpm
nano /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
location / {
root /opt/www;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /opt/www;
}
location ~ \.php$ {
root /opt/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
vi nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
‘$status $body_bytes_sent "$http_referer" ‘
‘"$http_user_agent" "$http_x_forwarded_for"‘;
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
}
systemctl restart nginx
systemctl start mariadb
mysql_secure_installation
systemctl enable mariadb.service