Centos相关,  技术分享

搭建wordpress站点

如果 要搭建多目录的站点:https://www.wbolt.com/wordpress-multisite.html
mysql安装:https://www.cnblogs.com/angbors/p/17189610.html
参考:https://cn.linux-console.net/?p=1601#gsc.tab=0
需要修改的地方 下面这个配置即支持http,也支持https ,如果用https,首先要申请好证书
1、 /etc/nginx/conf.d/aifamily.conf
server {
listen 443 ssl;
ssl_session_timeout 5m;
ssl_certificate /etc/nginx/cert/aifamily.cert;
ssl_certificate_key /etc/nginx/cert/aifamily.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;

server_name oneai.eu.org www.oneai.eu.org;
root /var/www/html/aifamily;
error_log /var/log/nginx/aifamily_error.log;
access_log /var/log/nginx/aifamily_access.log;

location / {
index index.html index.htm index.php;
}
client_max_body_size 1024M;
location ~ .php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

server {
listen 80;
server_name oneai.eu.org www.oneai.eu.org;
rewrite ^/(.*) https://$server_name$request_uri? permanent;
}


2、
vi /etc/php/7.4/fpm/pool.d/www.conf

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
; listen = /run/php/php7.4-fpm.sock
listen = 127.0.0.1:9000

; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 511

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0660

3、一定要放开相关的外网端口 80

ngnix_web.conf 参考:

server {
listen 80;
listen [::]:80;
server_name localhost aifamily;
root /var/www/html/aifamily;
index index.php index.html index.htm index.nginx-debian.html;

location / {
autoindex on;
root /var/www/html/aifamily;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php;
}

location ~ ^/wp-json/ {
rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}

location ~* /wp-sitemap.*.xml {
try_files $uri $uri/ /index.php$is_args$args;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

client_max_body_size 20M;

location = /50x.html {
root /usr/share/nginx/html;
}

location ~ .php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_buffers 1024 4k;
fastcgi_buffer_size 128k;

# Add headers to serve security related headers
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Permitted-Cross-Domain-Policies none;
add_header X-Frame-Options "SAMEORIGIN";

}

#enable gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_comp_level 5;
gzip_types application/json text/css application/x-javascript application/javascript image/svg+xml;
gzip_proxied any;

# A long browser cache lifetime can speed up repeat visits to your page
location ~* .(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
}

留言

您的邮箱地址不会被公开。 必填项已用 * 标注