2015-04-23 66 views
0

我有服務器,其中有不同類型的項目部署。一些項目在php ans一些在java war文件中爲jboss。所以我使用nginx的這一層,它正在以下罰款配置我們可以在Nginx中配置txt文件定位器

for PHP項目

location ~ \.php$ { 
      root   html; 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name; 
      include  fastcgi_params; 
     } 

     location ~ ^/(images|javascript|js|css|flash|media|static)/ { 
      root html/static; 
      expires 30d; 
     } 
     location ~ attendance/(js|css|images)/ { 
     # root html; 
      expires 30d; 


     } 

對於Java項目

server { 
     listen  80; 
     server_name ncmmi02; 

     #charset koi8-r; 

     access_log /mnt/vol1/nginx_logs/host.access.log; 

     location/{ 
      root html; 
      access_log off; 
      proxy_pass http://10.20.9.13:9090; 
      proxy_set_header X-Real-IP $remote_addr; 
      proxy_set_header Host $host; 
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
      # proxy_redirect off; 
     } 

for Java項目來看,我必須使用example.com/abc (ABC戰爭文件) 和php項目我使用example.com/attendance

現在我想要txt文件來顯示像example.com/rom.txt的數據 但這次在瀏覽器中包含不顯示

回答

1

添加這個位置正下方* .PHP一個

location ~ *\.txt$ { 
    root /path/to/your/root; 
} 
相關問題