Centos上的Nginx配置

时间:2015-07-07 17:34:11

标签: nginx centos7

我从weloveservers提供商那里购买了新的VPS。我的VPS操作系统是Centos 7。我分配的IP是192.3.108.207。我用ssh安装了Nginx。现在我需要在我的IP地址上显示一些内容。如何将我的IP指向特定文件夹..我目前的nginx配置如下,

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
  worker_connections 1024;
}

http {

access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

}

这是我的virtual.conf

server {
    listen       80;
    server_name  192.3.108.207;
    root   /var/www;

   #charset koi8-r;
   #access_log  /var/log/nginx/log/host.access.log  main;

   location / {
      root   /var/www;
      index  index.php index.html index.htm;
      try_files $uri $uri/ /index.php?$args;
  }


}

1 个答案:

答案 0 :(得分:0)

您可以在virtual.conf中指定特定文件夹。 正如您在virtual.conf root / var / www中提到的那样;

而不是/ var / www; ,您可以提供文件夹名称并重新启动nginx服务。