nginx虚拟主机添加
1. 进入 /usr/local/nginx/conf/vhost 目录, 创建虚拟主机配置文件 wbs.test.com.conf ({域名}.conf).
2.打开配置文件, 添加服务如下:
log_format wbs.test.com '$remote_addr - $remote_user [$time_local] $request'
'$status $body_bytes_sent $http_referer '
'$http_user_agent $http_x_forwarded_for';
server {
listen 80;
server_name wbs.test.com;
index index.html index.htm index.php;
root /data/www/wbs.test.com;
location ~ .*\.(php|php5)?$ {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
#include fastcgi_params;
include fastcgi.conf;
}
access_log /data/logs/wbs.test.com-access.log wbs.test.com;
error_log /data/logs/wbs.test.com-error.log notice;
}
3.打开 Nginx 配置文件 /usr/local/nginx/conf/nginx.conf, 在 http
范围引入虚拟主机配置文件如下:
include vhost/*.conf;
4.重启nginx
service nginx restart
最新文章
- 如何利用sendmail发送外部邮件?
- MVC 生成图片,下载文件(图片不存在本地,在网上下载)
- 基础知识系列☞IList ←vs→ List
- poj 3735 Training little cats 矩阵快速幂+稀疏矩阵乘法优化
- i.BIO方式的SSL通道流程
- ModelAttribute注解
- Linux设备驱动之semaphore机制【转】
- openssl数字证书私钥删除私钥密码
- JavaScript入门(7)
- Ubuntu 批量添加用户
- Nginx反代Mogilefs分布式储存示例
- Python示例
- P1547 Out of Hay
- 编程四剑客sed-2019.2.20
- Angularjs的directive封装ztree
- Redis持久化——AOF
- java的跳转和重定向,加载显示层
- XML--将XML中数据提取出转换成表
- 021.5 IO流——字符流
- sql server中index的REBUILD和REORGANIZE的区别及工作方式