$ hostnamectl Static hostname: test-70-36 Operating System: CentOS Linux 7 (Core) Kernel: Linux 5.4.278-1.el7.elrepo.x86_64 Architecture: x86-64 $ free -h Mem: 31G total / 26G available Swap: 8.0G $ df -hT / /data / ext4 90G total / 81G available / 7% used /data ext4 296G total / 269G available / 5% used $ nginx -v ; php -v ; mysql --version nginx/1.26.0 PHP 5.6.40 MySQL 5.6.51 $ ss -lntp | grep -E ':(22|80|443|3306)\b' LISTEN 22/ssh · 80/nginx · 3306/mysql 443 未监听(当前未部署 HTTPS)
server { listen 80; server_name 172.16.70.36; index index.html index.htm index.php; root /data/wwwroot/sxityjydy3/public; include rewrite/thinkphp.conf; include enable-php-pathinfo.conf; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /home/wwwlogs/172.16.70.36.log; } # rewrite/thinkphp.conf location / { if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } if ($request_uri = "/") { return 301 /dist/; }
/tmp/php-cgi.sock 接入;open_basedir 为 $document_root/../:/tmp/:/proc/。修改后必须先执行 Nginx 语法检查,再 reload。$ nginx -t syntax is ok test is successful $ service nginx status $ service php-fpm status $ service mysql status nginx is running php-fpm is running MySQL is running $ curl http://127.0.0.1/ 301 → http://172.16.70.36/dist/ $ curl http://172.16.70.36/dist/ 200 OK · 前端 JS/CSS 四项抽查均为 200