配置nginx
首先apt install nginx
然后安装php
apt-get install php7.0-fpm php7.0-mysql php7.0-common php7.0-mbstring php7.0-gd php7.0-json php7.0-cli php7.0-curl
然后配置nginx里面的server 具体位置不定,我的在/etc/nginx/
把server贴进去
server { listen 80; server_name www.test.com; root /var/www/htmk; index index.php index.html index.htm; location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; } } location ~ .php { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; #fastcgi_pass 127.0.0.1:9000; #如果使用cgi的话就用这行
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; #用php-fpm就用这行 fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; } }
/etc/init.d/nginx reload
/etc/init.d/nginx start
/etc/init.d/php-fpm reload
/etc/init.d/php-fpm start