可以通过添加官网源,安装最新 nginx 版本
常用
# 服务管理nginx -s start|stop|restartservice nginx start|stop|restart/etc/nginx/nginx.conf # 配置文件# 常用配置user www www;worker_processes 4;# nginx + phpserver { listen 80; autoindex on; # 测试用, 可以查看文件列表 root /vagrant; # 在这里写就不用在每个 location 下写 index index.html index.htm index.php; location / { } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { # root html; fastcgi_pass 127.0.0.1:9000; # 了解 tcp/ip 基础的话, 这里还可以配置成 unix 本地协议簇 # fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # $document_root 对应上面设置的 root, 这里的设置是为了找到需要执行的 php 文件 include fastcgi_params; }}# 只允许访问项目的 public 目录root /vagrant/shoufuyou/shoufuyou-www/public;try_files $uri $uri/ /index.php?$args;