yum 安装lnmp后配置
- 创建nginx与php-fpm 启动用户
useradd www -s /sbin/nologin
- 修改 /etc/php-fpm.d/www.conf
# 修改 user = www group = www listen.owner = www listen.group = www listen.mode = 0777 listen = /run/php-fpm/www.sock
- 修改 /etc/nginx/nginx.conf
user www; worker_processes auto;
server 模块示例:
server { listen 80; #listen [::]:80; server_name localhost; index index.html index.htm index.php; root /data/web/test; #error_page 404 /404.html; location ~ \.php$ { fastcgi_pass unix:/run/php-fpm/www.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /.well-known { allow all; } location ~ /\. { deny all; } access_log /data/wwwlogs/access.log; }
- 重置mysql密码:
# 使用 mysqladmin 命令 mysqladmin -u root password