美文网首页
PHP-Ngnix环境搭建

PHP-Ngnix环境搭建

作者: Kevin_bin | 来源:发表于2016-12-22 17:14 被阅读101次

本文涉及PHP开发中一些环境搭建,如Larval和Ngnix。

Nginx

Nginx启动关闭命令
 #测试配置是否有语法错误
 nginx -t

 #打开 nginx
 sudo nginx

 #重新加载配置|重启|停止|退出 nginx
 nginx -s reload|reopen|stop|quit
Nginx server 配置
  • 进入/usr/local/etc/nginx目录;
  • 使用mkdir servers创建servers目录;
  • vim nginx.conf打开nginx配置文件;
  • nginx.conf文件中加入include servers/*;添加结果如http{ include servers/*; },
  • 在servers目录下,创建*.conf文件,以下实例为laravel.conf
server {
 listen 8081;
 server_name localhost;

 # 设定网站根目录
 root /Users/kevin/www/bi.service/public;
 # 网站默认首页
 index index.php index.html index.htm;

 # 修改为 Laravel 转发规则,否则PHP无法获取$_GET信息,提示404错误
 location / {
     try_files $uri $uri/ /index.php?$query_string;
 }

 # PHP 支持
 location ~ \.php$ {
     try_files $uri /index.php =404;
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
     fastcgi_pass 127.0.0.1:9000;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include fastcgi_params;
 }
}

相关文章

  • PHP-Ngnix环境搭建

    本文涉及PHP开发中一些环境搭建,如Larval和Ngnix。 Nginx Nginx启动关闭命令 Nginx s...

  • React Native学习总结篇

    一、环境搭建 1.1 React Native环境搭建 1.1.1 IOS环境搭建 环境:MacOS 注意:不要使...

  • linux 第四天

    Lamp环境搭建 /*******************Lamp环境搭建:*******************...

  • codePush说明

    codePush环境搭建 环境搭建文章:环境搭建 git地址:codePush git地址2.0.3,And...

  • angular学习--02英雄指南

    环境搭建 angular官网--搭建本地开发环境和工作空间windows 10 搭建angular开发环境免搭建环...

  • Gradle开发-Groovy环境搭建

    ##Groovy环境搭建 在使用 Groovy 之前首先要搭建几个环境: Groovy 的环境搭建 JDK 环境搭...

  • 搭建 LNMP + CodeIgniter 开发环境

    搭建 LNMP + CodeIgniter 开发环境搭建 LNMP 环境首先搭建 LNMP 的服务器环境安装 Ng...

  • iOS中RN与Flutter混合开发

    一 搭建环境 1. 搭建flutter环境 1.1 搭建系统开发环境 参考链接:https://flutter....

  • 第一个MyBatis程序

    思路:搭建环境---导入MyBatis--编写代码---测试! 一、搭建环境 1、搭建数据库环境: engine=...

  • Robot Framework用法总结

    一,环境的搭建 关于robotframework环境搭建请参考博文:Robot Framework的环境搭建[ht...

网友评论

      本文标题:PHP-Ngnix环境搭建

      本文链接:https://www.haomeiwen.com/subject/qolhvttx.html