Ubuntu14配置nginx虚拟主机
来源:互联网 发布:react js 阮一峰 编辑:程序博客网 时间:2024/05/16 13:03
一、建立项目目录
# 在 /home/share/ 目录下创建一个test项目目录,并编辑一个子目录 index.php 文件
# 新建一个主页 index.php文件
三、更改 hosts
# 添加your_ip_address test.com
我是在windows下 Windows\System32\drivers\etc
四、重启
或
重新加载nginx使配置生效
五、访问windows浏览器访问
http://test.com/index.php
# 在 /home/share/ 目录下创建一个test项目目录,并编辑一个子目录 index.php 文件
sudo mkdir -p /home/share/test
# 新建一个主页 index.php文件
sudo vim /home/share/test/index.php
test为项目根目录
二、配置文件
# 创建 server 虚拟主机配置文件
sudo vim /etc/nginx/sites-available/test.com
server { listen 80; listen [::]:80; server_name test.com; root /home/share/test;#配到index.php访问的时候直接可以test.com#配到test必须test.com/index.php访问#跟下面默认访问文件配置相关 index index.html index.htm index.nginx-debian.html; location / { try_files $uri $uri/ =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }}
#因为nginx的主配置文件nginx.conf会自动应用sites-enabled中的配置文件
#所以我们需要在sites-enabled中创建一个软链接到 /etc/nginx/sites-enabled/ 目录下,
sudo ln-s /etc/nginx/sites-available/test.com /etc/nginx/sites-enabled/
使配置文件生效
三、更改 hosts
# 添加your_ip_address test.com
我是在windows下 Windows\System32\drivers\etc
四、重启
sudo /etc/init.d/nginx restart
或
重新加载nginx使配置生效
$ sudo /etc/init.d/nginx reload
五、访问windows浏览器访问
http://test.com/index.php
阅读全文
0 0
- Ubuntu14配置nginx虚拟主机
- Nginx 配置虚拟主机
- nginx配置虚拟主机
- 【NGINX】虚拟主机配置示例
- Nginx虚拟主机配置教程
- Nginx 虚拟主机 VirtualHost 配置
- Nginx虚拟主机配置教程
- nginx配置虚拟主机
- nginx配置+虚拟主机
- Nginx虚拟主机配置
- Nginx 虚拟主机 VirtualHost 配置
- nginx虚拟主机配置实例
- Nginx 虚拟主机 VirtualHost 配置
- Nginx 虚拟主机 VirtualHost 配置
- nginx多虚拟主机配置
- Nginx的虚拟主机配置
- nginx---虚拟主机配置
- Nginx 虚拟主机 VirtualHost 配置
- BB = BB[sorted_ind, :] IndexError: too many indices for array
- BZOJ4029 4029: [HEOI2015]定价 贪心
- python中,从mysql读取数据,并存入redis里面(2)
- go语言学习-for循环
- 安卓黑马教学(二)
- Ubuntu14配置nginx虚拟主机
- Tensorflow移植到Android
- python中,从mysql读取数据,并存入redis里面(3)
- Binary Tree Level Order Traversal
- 日本邮政银行CIO谈论比特币“泡沫”,称其只值100美元
- BFS/DFS 判断是否是二分图
- ios-hitTest和pointInside简单介绍
- Windows Server 2012 R2搭建IIS服务器
- 【python学习记录】--0--前言--开始学派森