nginx.conf的server配置如下
server
{
listen 80;
server_name .ai9475.com; #注意前面的小数点,这样就不用配置www
index index.html index.htm index.php;
root /home/wwwroot/;
error_page 404 = /404.php; #需要在前面http中加 fastcgi_intercept_errors on;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /home/wwwlogs/access.log access;
}
include vhost/*.conf; #一定要包含在这个
有/usr/loca/nginx/conf/ 下创建vhost
添加一个文件ai9475_cn.conf文件,配置内容如下
server
{
listen 80;
server_name .ai9475.cn;
index index.html index.htm index.php;
root /home/wwwai9475cn/;
error_page 404 = /404.php;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
log_format commpany_access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /home/wwwlogs/access_ai9475cn.log commpany_access;
}
分享到:
相关推荐
Centos系统上 nginx 代理多个域名站点 nginx配置,多个域名解析到同一IP,服务器上启动多个服务
centOS8安装nginx及nginx配置
CentOS7.3下Nginx基于IP+端口的虚拟主机配置实战,有需要的可以看一下
centos7.6离线安装nginx
nginx.conf nginx-1.20.1.tar.gz 这是关于centos8的nginx 和nginx 的配置https文件
centos7安装nginx1.16.1安装文档,有需要的朋友们下载。 centos7安装nginx1.16.1安装文档,有需要的朋友们下载。
对于Nginx,一个IP上配置多个站点还是很常见的。尤其是在开发环境上,更是如此。 下面在我的阿里云上简单的实现这样一个需求: 在一个IP上通过对端口区分来配置多个站点。 环境初始化目录一览配置站点准备添加配置...
centos7配置nginx虚拟主机
CentOS5.5 安装nginx的详细步骤
CentOS 6.5 安装 Nginx 1.7.8 教程
非root下,离线安装nginx依赖加nginx安装包,需要先装gcc-c++
Nginx 是一款轻量级的 Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,它是由 C 语言开发,建议在 Linux 下运行。 该文档编写了centos下安装nginx的详细步骤及配置说明。
centos源码安装nginx-1.20.2+nginx负载均衡
CentOS6.5 一键nginx安装, 需要root权限,并配置好DNS 外网畅通
由于Windows电脑是图形化界面,单网卡配置多个IP地址很容易,并且网上教程比较多。然而Linux一般都是用命令行配置IP地址,Linux版本较多,对于CentOS系统而...本文是对CentOS7版本如何进行单网卡配置多个IP地址的方法。
Linux(CentOS8) Nginx配置TCP负载均衡
CentOS6.8 安装 Nginx 配置负载CentOS6.8 安装 Nginx 配置负载
在完全无互联网连接的情况下,离线安装nginx。 nginx版本号:nginx-1.20.1-2.el7.x86_64 食用方法: 1.解压 2.进入解压目录 3.rpm安装全部 4.安装完成
源码平滑升级升级:本方式适用于使用源码安装nginx的方式,通过替换nginx二进制文件完成升级,原理就是Ngnix中的进程分为两类,一类是master进程(主进程),一类是worker进程(工作进程),首先我们先会替换...
centos版本7.6,nginx版本1.14.2,tomcat版本8.5.37,jdk版本1.8.0_201,实现nginx的代理,访问不同的tomcat