Heim Betrieb und Instandhaltung Nginx So implementieren Sie das Nginx-Proxy-Ausgabe-Zoombild

So implementieren Sie das Nginx-Proxy-Ausgabe-Zoombild

May 16, 2023 pm 01:55 PM
nginx

nginx-Konfigurationsdatei:

# document ppt convert configuration.
upstream document.polyv.net {
 server 127.0.0.1:8080;
}

server {
 listen 80;
 server_name document.polyv.net;
 index index.html index.htm;
 charset utf-8;
 client_max_body_size 1000m;

 # ignore favicon.ico not exist.
 location = /favicon.ico {
  log_not_found off;
  access_log off;
 }

 # not allow to visit hidden files.
 location ~ /\. {
  deny all;
  access_log off;
  log_not_found off;
 }

 location / {
  if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$) {
   add_header content-disposition: 'attachment;';
   add_header content-type: 'application/octet-stream';
  }

  proxy_pass http://document.polyv.net;
  proxy_set_header x-real-ip $remote_addr;
  proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
  proxy_set_header request_host $host;

  # include proxy.conf;
  charset utf-8;
 }

 # user upload files
 location /images/ {
   #expires 7d;
  alias /data03/ovp/blobs/;
   proxy_store on;
   proxy_store_access user:rw group:rw all:rw;
   proxy_set_header accept-encoding "";
   if ( !-f $request_filename ) {
    proxy_pass http://document.polyv.net;
   }
 }

 location /blobs/ {
   #expires 7d;
  alias /data03/ovp/blobs/;
 }

  location /preview/images/ {
   #expires 7d;
   alias /data03/ovp/blobs/;
   proxy_store on;
   proxy_store_access user:rw group:rw all:rw;
   proxy_set_header accept-encoding "";
   if ( !-f $request_filename ) {
    proxy_pass http://document.polyv.net;
   }
  }

}
Nach dem Login kopieren

Agent gibt gezoomte Bilder aus

package com.document.handle.controller;

import java.io.bufferedinputstream;
import java.io.file;
import java.io.ioexception;
import java.io.outputstream;
import java.net.httpurlconnection;
import java.net.url;

import javax.servlet.http.httpservletrequest;
import javax.servlet.http.httpservletresponse;

import org.apache.commons.lang3.stringutils;
import org.slf4j.logger;
import org.slf4j.loggerfactory;
import org.springframework.stereotype.controller;
import org.springframework.web.bind.servletrequestutils;
import org.springframework.web.bind.annotation.pathvariable;
import org.springframework.web.bind.annotation.requestmapping;

import com.document.tool.imagemagickutils;
import com.document.tool.systemconfig;

@controller
public class imageagentcontroller {

 private static final logger log = loggerfactory.getlogger(imageagentcontroller.class);

 /**
  * ppt预览图片代理输出
  * @throws ioexception
  */
 @requestmapping("/preview/images/{year}/{month}/{md5id}/{preview}/{filename}.{ext}")
 public void cropimage(@pathvariable string year, @pathvariable string month, @pathvariable string md5id,
   @pathvariable string preview, @pathvariable string filename, @pathvariable string ext,
   httpservletrequest request, httpservletresponse response) throws ioexception {
  // string rootdir = "/data03/ovp/blobs/";
  string rootdir = systemconfig.getblobdirectory();
  string oname = filename.substring(1, filename.length());// 原图文件名
  string dirstring = rootdir + year + "/" + month + "/" + md5id + "/" + oname + "." + ext;
  string targetfilestring = rootdir + year + "/" + month + "/" + md5id + "/preview/" + filename + "." + ext;

  //如果原图存在
  file originimage = new file(oname);
  if(originimage.exists()){
   log.info("corpimage..." + dirstring + " -> " + targetfilestring);
   file newfile = new file(targetfilestring);
   string pathstring = newfile.getparent();
   log.info("pathstring...{} {}", pathstring);
   file pathfile = new file(pathstring);
   if (!pathfile.exists()) {
    log.info("---create file---");
    pathfile.mkdirs();
   }
   boolean status = imagemagickutils.scale(dirstring, targetfilestring, 240, 180);
   if (status) {
    response.reset();
    response.setcontenttype("image/" + ext);

    java.io.inputstream in = new java.io.fileinputstream(targetfilestring);
    // filenameurlutils.getimagefilename(targetfilestring);

    if (in != null) {
     byte[] b = new byte[1024];
     int len;
     while ((len = in.read(b)) != -1) {
      response.getoutputstream().write(b);
     }

     in.close();
    }
   }
  }else{
   log.info("原图目录不存在-preview:{}",dirstring); 
  }
 }


 /**
  * ppt固定尺寸图片代理输出
  * @throws ioexception
  * https://cache.yisu.com/upload/ask_collection/20210726/113/19154.png
  *
  * http://document.polyv.net/images/2016/03/de37d2ceb11ac068c18c5e4428541075/jpg-3.png
  */
 @requestmapping("/images/{year}/{month}/{md5id}/{filename}/{width}x{height}.{ext}")
 public void cropfixedimage(@pathvariable string year, @pathvariable string month, @pathvariable string md5id,
   @pathvariable string filename, @pathvariable integer width, @pathvariable integer height, @pathvariable string ext,
   httpservletrequest request, httpservletresponse response) throws ioexception {
  // string rootdir = "/data03/ovp/blobs/";
  string rootdir = systemconfig.getblobdirectory();
  //string oname = filename.substring(1, filename.length());// 原图文件名
  string dirstring = rootdir + year + "/" + month + "/" + md5id + "/" + ( filename + "." + ext);
  string targetfilestring = rootdir + year + "/" + month + "/" + md5id + "/" + filename + "/" + (width + "x" + height + "." + ext);

  //如果原图存在
  file originimage = new file(dirstring);
  if(originimage.exists()){
   file targetfilestringfile = new file(targetfilestring);
   if(!targetfilestringfile.exists()){
    log.info("corpimage..." + dirstring + " -> " + targetfilestring);
    file newfile = new file(targetfilestring);
    string pathstring = newfile.getparent();
    log.info("pathstring...{} {}", pathstring);
    file pathfile = new file(pathstring);
    if (!pathfile.exists()) {
     log.info("---create file---");
     pathfile.mkdirs();
    }
    imagemagickutils.resizewh(dirstring, targetfilestring,width,height);
   }
   response.setcontenttype("image/" + ext);
   java.io.inputstream in = null;
   try{
    in = new java.io.fileinputstream(targetfilestring);
    response.setcontentlength(in.available());
    byte[] buffer = new byte[1024];
    int count = 0;
    while ((count = in.read(buffer)) > 0) {
     response.getoutputstream().write(buffer, 0, count);
    }
    response.flushbuffer();
   }catch(exception e){
    e.printstacktrace();
   }finally {
    try {
     in.close();
    } catch (exception e) {

    }
   }
  }else{
   log.info("原图目录不存在:{}",dirstring);
  }




 }


 /**
  * 图片下载
  */
 @requestmapping("get/image/data")
 public void downloadimage(httpservletrequest request, httpservletresponse response) throws ioexception { 
  string filepath = servletrequestutils.getstringparameter(request, "filepath", ""); //图片访问路劲
  string filename = servletrequestutils.getstringparameter(request, "filename", ""); //名称

  if(stringutils.isnotblank(filepath) || stringutils.isnotblank(filename)){
   string desturl = filepath;
   //log.info("--------------"+filepath); 
   string fileformat=filepath.substring(filepath.lastindexof("."));
   //string name=filename.trim()+fileformat;
   string name=filepath.substring(filepath.lastindexof("/")+1, filepath.length()); 
   //file f = new file(filepath);
   //response.setheader("content-disposition", "attachment; filename="+java.net.urlencoder.encode(f.getname(),"utf-8")); 
   //log.info("--------------"+f.getname());

   // 建立链接 
   url url = new url(desturl); 
   httpurlconnection httpurl = (httpurlconnection) url.openconnection(); 
   // 连接指定的资源 
   httpurl.connect(); 
   // 获取网络输入流 
   bufferedinputstream bis = new bufferedinputstream(httpurl.getinputstream()); 

   integer lenf=httpurl.getcontentlength();
   //string lenf=this.getfilelength(4189053, 7189053);
   response.setcontenttype("application/x-msdownload"); 
   response.setheader("content-length", lenf.tostring());//文件大小值5几m
   response.setheader("content-disposition", "attachment; filename="+java.net.urlencoder.encode(name,"utf-8"));
   outputstream out = response.getoutputstream();
   byte[] buf = new byte[1024]; 
   if (desturl != null) { 
    bufferedinputstream br = bis; 
    int len = 0; 
    while ((len = br.read(buf)) > 0){ 
     out.write(buf, 0, len); 
    }     
    br.close(); 
   } 
   out.flush(); 
   out.close(); 
  }

 } 

}
Nach dem Login kopieren

Geschäft zum Bildzoomen

package com.document.tool;

import java.io.ioexception;

import javax.swing.imageicon;

import org.apache.commons.exec.commandline;
import org.apache.commons.exec.defaultexecuteresulthandler;
import org.apache.commons.exec.defaultexecutor;
import org.apache.commons.exec.executeexception;
import org.apache.commons.exec.executewatchdog;
import org.apache.commons.exec.executor;
import org.slf4j.logger;
import org.slf4j.loggerfactory;

/**
 * 使用imagemagick对图片文件进行处理的工具类。
 * @author xingning ou
 */
public abstract class imagemagickutils {

 private static final string executable_convert = "/usr/bin/convert"; // convert命令

 private static final string executable_composite = "/usr/bin/composite"; // composite命令

 private static final long execute_timeout = 30 * 60 * 1000l; // 30 minutes

 private static final logger log = loggerfactory.getlogger(imagemagickutils.class);

 /**
  * 执行图片处理的命令。
  * @param cmdline 待执行的命令
  * @return exitvalue,一般等于0时表示正常运行结束
  * @throws executeexception 命令执行失败时抛出此异常
  * @throws ioexception 当发生io错误时抛出此异常
  * @throws interruptedexception 当等待异步返回结果被中断时抛出此异常
  */
 public static int executecommandline(commandline cmdline) throws executeexception, ioexception,
 interruptedexception {
  executor executor = new defaultexecutor();
  executor.setexitvalue(0);

  // kill a run-away process after execute_time milliseconds.
  executewatchdog watchdog = new executewatchdog(execute_timeout);
  executor.setwatchdog(watchdog);

  // execute the print job asynchronously.
  defaultexecuteresulthandler resulthandler = new defaultexecuteresulthandler();
  executor.execute(cmdline, resulthandler);

  // some time later the result handler callback was invoked.
  resulthandler.waitfor();

  // so we can safely request the exit value.
  return resulthandler.getexitvalue();
 }

 /**
  * 按照高宽比例缩小图片。
  * @param src 源图片
  * @param dst 目标图片
  * @param width 图片图片的宽度
  * @param height 目标图片的高度
  * @return 是否处理成功
  */
 public static boolean scale(string src, string dst, int width, int height) {
  // 构建命令
  commandline cmdline = new commandline(executable_convert);
  cmdline.addargument(src);
  cmdline.addargument("-scale");
  cmdline.addargument(width + "x" + height);
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("缩略图片时发生异常,cause: ", e);
   return false;
  }
 }

 /**
  * 按照高宽比例缩小图片。
  * @param src 源图片
  * @param dst 目标图片
  * @param width 图片图片的宽度
  * @param height 目标图片的高度
  * @return 是否处理成功
  */
 public static boolean thumbnail(string src, string dst, int width, int height) {
  // 构建命令
  commandline cmdline = new commandline(executable_convert);
  cmdline.addargument(src);
  cmdline.addargument("-thumbnail");
  cmdline.addargument(width + "x" + height);
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("缩略图片时发生异常,cause: ", e);
   return false;
  }
 }

 /**
  * 添加图片水印。
  * @param src 源图片
  * @param dst 目标图片
  * @param logofile 水印图片
  * @param dissolve 和水印的融合度,0-100的数字
  * @param gravity 叠放方向,east,west,north,south,northeast,northwest,southeast,southwest
  * @return 是否处理成功
  */
 public static boolean drawlogo(string src, string dst, string logofile, int dissolve, string gravity) {
  // 构建命令
  commandline cmdline = new commandline(executable_composite);
  cmdline.addargument("-dissolve");
  cmdline.addargument(dissolve + "%");
  cmdline.addargument("-gravity");
  cmdline.addargument(gravity);
  cmdline.addargument(logofile);
  cmdline.addargument(src);
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("添加图片水印时发生异常,cause: ", e);
   return false;
  }
 }

 /**
  * 添加图片水印。
  * @param src 源图片
  * @param dst 目标图片
  * @param logofile 水印图片
  * @param dissolve 和水印的融合度,0-100的数字
  * @param x 水印距离左下角的距离
  * @param y 水印距离右下角的距离
  * @return 是否处理成功
  */
 public static boolean drawlogo(string src, string dst, string logofile, int dissolve, int x, int y) {
  imageicon icon = new imageicon(src);
  int width = icon.geticonwidth(); // 源图的宽
  int height = icon.geticonheight(); // 源图的高

  string _x = string.valueof(width - x); // 在x轴上水印图片的左上顶点距离图片左上角的距离
  string _y = string.valueof(height - y); // 在y轴上水印图片的左上顶点距离图片左上角的距离

  // 构建命令
  commandline cmdline = new commandline(executable_composite);
  cmdline.addargument("-dissolve");
  cmdline.addargument(dissolve + "%");
  cmdline.addargument("-geometry");
  cmdline.addargument(_x + "+" + _y);
  cmdline.addargument(logofile);
  cmdline.addargument(src);
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("添加图片水印时发生异常,cause: ", e);
   return false;
  }
 }

 /**
  * 裁剪图片。
  * @param src 源图片
  * @param dst 目标图片
  * @param width 目标宽度
  * @param height 目标高度
  * @param left 裁剪位置:距离左边的像素
  * @param top 裁剪位置:距离上边的像素
  * @return 是否处理成功
  */
 public static boolean crop(string src, string dst, int width, int height, int left, int top) {
  // 构建命令
  commandline cmdline = new commandline(executable_convert);
  cmdline.addargument(src);
  cmdline.addargument("-crop");
  cmdline.addargument(width + "x" + height + "+" + left + "+" + top);
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("裁剪图片时发生异常,cause: ", e);
   return false;
  }
 }

 /**
  * 获取矩形的小图。
  * @param src 源图片
  * @param dst 目标图片
  * @param width 目标宽度
  * @param height 目标高度
  * @param left 裁剪位置:距离左边的像素
  * @param top 裁剪位置:距离上边的像素
  * @return 是否处理成功
  */
 public static boolean croprect(string src, string dst, int width, int height, int left, int top) {
  imageicon icon = new imageicon(src);
  int origwidth = icon.geticonwidth();
  int origheight = icon.geticonheight();
  int[] s = new int[2];
  if (origwidth < origheight) { // 以宽为标准
   s = getsize(origwidth, origheight, width, height, 1);
  } else {// 以高为标准
   s = getsize(origwidth, origheight, width, height, 2);
  }

  if (thumbnail(src, dst, s[0], s[1])) {
   return crop(src, dst, width, height, left, top);
  }
  return false;
 }

 /**
  * 加边框。
  * @param src 源图片
  * @param dst 目标图片
  * @param borderwidth 边框的宽度
  * @param borderheight 边框的高度
  * @param bordercolor 边框的颜色
  * @return 是否处理成功
  */
 public static boolean border(string src, string dst, int borderwidth, int borderheight, string bordercolor) {
  // 构建命令
  commandline cmdline = new commandline(executable_convert);
  cmdline.addargument("-bordercolor");
  cmdline.addargument(bordercolor);
  cmdline.addargument("-border");
  cmdline.addargument(borderwidth + "x" + borderheight);
  cmdline.addargument(src);
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("加图片边框时发生异常,cause: ", e);
   return false;
  }
 }

 /**
  * 转换图片格式。
  * @param src 源图片
  * @param dst 目标图片
  * @param format 转换的格式
  * @return 是否处理成功
  */
 public static boolean format(string src, string dst, string format) {
  // 构建命令
  commandline cmdline = new commandline(executable_convert);
  cmdline.addargument(src);
  cmdline.addargument("-format");
  cmdline.addargument("&#39;" + format + "&#39;");
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("转换图片格式时发生异常,cause: ", e);
   return false;
  }
 }

 /**
  * 转换无限极的tiff图片。
  */
 public static boolean converttiff(string src, string dst) {  
  // 构建命令
  commandline cmdline = new commandline(executable_convert);
  cmdline.addargument(src);
  cmdline.addargument("-colorspace");
  cmdline.addargument("rgb");
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("转换图片格式时发生异常,cause: ", e);
   return false;
  }
 }


 /**
  * 获得要压缩图片的大小。
  * @param w 图片的原宽度
  * @param h 图片的原高度
  * @param width 标准宽
  * @param height 标准高
  * @param type 类型 1-以宽为标准压缩 2-以高为标准压缩 3-以比例大小压缩
  * @return size[0]-要压缩的宽度, size[1]-要压缩的高度
  */
 public static int[] getsize(double w, double h, double width, double height, int type) {
  if (w < width) {// 如果原宽度比标准宽度小
   width = w;
  }
  if (h < height) {// 如果原高度比标准高度小
   height = h;
  }
  double scale = w / h;
  switch (type) {
   case 1:
    height = width / scale;
    break;
   case 2:
    width = height * scale;
    break;
   case 3:
    if (width / height > scale) {
     width = height * scale;
    } else if ((width / height) < scale) {
     height = width / scale;
    }
    break;
  }
  int[] size = new int[2];
  size[0] = (int) width;
  size[1] = (int) height;
  return size;
 }


 /**
  * 指定宽度。
  * @param src
  * @param width
  * @param dst
  */
 public static boolean resize(string src, int width, string dst) {
  // 构建命令
  commandline cmdline = new commandline(executable_convert);
  cmdline.addargument(src);
  cmdline.addargument("-resize");
  cmdline.addargument(width + "");
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("缩略图片时发生异常,cause: ", e);
   return false;
  }
 }

 /**
  * 指定宽度、高度。
  * @param src
  * @param width
  * @param dst
  */
 public static boolean resizewh(string src,string dst, int width, int height ) {
  // 构建命令
  commandline cmdline = new commandline(executable_convert);
  cmdline.addargument(src);
  cmdline.addargument("-resize");
  cmdline.addargument(width + "x" + height +"!");
  cmdline.addargument(dst);

  try {
   executecommandline(cmdline);
   return true;
  } catch (exception e) {
   log.error("缩略图片时发生异常,cause: ", e);
   return false;
  }
 }
}
Nach dem Login kopieren

imagemagick muss auf dem Server installiert werden.

Das obige ist der detaillierte Inhalt vonSo implementieren Sie das Nginx-Proxy-Ausgabe-Zoombild. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn

Heiße KI -Werkzeuge

Undresser.AI Undress

Undresser.AI Undress

KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover

AI Clothes Remover

Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool

Undress AI Tool

Ausziehbilder kostenlos

Clothoff.io

Clothoff.io

KI-Kleiderentferner

AI Hentai Generator

AI Hentai Generator

Erstellen Sie kostenlos Ai Hentai.

Heißer Artikel

R.E.P.O. Energiekristalle erklärten und was sie tun (gelber Kristall)
1 Monate vor By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Beste grafische Einstellungen
1 Monate vor By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Crossplay haben?
1 Monate vor By 尊渡假赌尊渡假赌尊渡假赌

Heiße Werkzeuge

Notepad++7.3.1

Notepad++7.3.1

Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version

SublimeText3 chinesische Version

Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1

Senden Sie Studio 13.0.1

Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6

Dreamweaver CS6

Visuelle Webentwicklungstools

SublimeText3 Mac-Version

SublimeText3 Mac-Version

Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

So überprüfen Sie, ob Nginx gestartet wird So überprüfen Sie, ob Nginx gestartet wird Apr 14, 2025 pm 01:03 PM

So bestätigen Sie, ob Nginx gestartet wird: 1. Verwenden Sie die Befehlszeile: SystemCTL Status Nginx (Linux/Unix), Netstat -ano | FindStr 80 (Windows); 2. Überprüfen Sie, ob Port 80 geöffnet ist; 3. Überprüfen Sie die Nginx -Startmeldung im Systemprotokoll. 4. Verwenden Sie Tools von Drittanbietern wie Nagios, Zabbix und Icinga.

So konfigurieren Sie Nginx in Windows So konfigurieren Sie Nginx in Windows Apr 14, 2025 pm 12:57 PM

Wie konfiguriere ich Nginx in Windows? Installieren Sie NGINX und erstellen Sie eine virtuelle Hostkonfiguration. Ändern Sie die Hauptkonfigurationsdatei und geben Sie die Konfiguration der virtuellen Host ein. Starten oder laden Nginx neu. Testen Sie die Konfiguration und sehen Sie sich die Website an. Aktivieren Sie selektiv SSL und konfigurieren Sie SSL -Zertifikate. Stellen Sie die Firewall selektiv fest, damit Port 80 und 443 Verkehr.

So konfigurieren Sie den Namen des Cloud -Server -Domänennamens in Nginx So konfigurieren Sie den Namen des Cloud -Server -Domänennamens in Nginx Apr 14, 2025 pm 12:18 PM

So konfigurieren Sie einen Nginx -Domänennamen auf einem Cloud -Server: Erstellen Sie einen Datensatz, der auf die öffentliche IP -Adresse des Cloud -Servers zeigt. Fügen Sie virtuelle Hostblöcke in die NGINX -Konfigurationsdatei hinzu, wobei der Hörport, Domänenname und das Root -Verzeichnis der Website angegeben werden. Starten Sie Nginx neu, um die Änderungen anzuwenden. Greifen Sie auf die Konfiguration des Domänennamens zu. Weitere Hinweise: Installieren Sie das SSL -Zertifikat, um HTTPS zu aktivieren, sicherzustellen, dass die Firewall den Verkehr von Port 80 ermöglicht, und warten Sie, bis die DNS -Auflösung wirksam wird.

So starten Sie den Nginx -Server So starten Sie den Nginx -Server Apr 14, 2025 pm 12:27 PM

Das Starten eines Nginx-Servers erfordert unterschiedliche Schritte gemäß verschiedenen Betriebssystemen: Linux/UNIX-System: Installieren Sie das NGINX-Paket (z. B. mit APT-Get oder Yum). Verwenden Sie SystemCTL, um einen Nginx -Dienst zu starten (z. B. sudo systemctl start nginx). Windows -System: Laden Sie Windows -Binärdateien herunter und installieren Sie sie. Starten Sie Nginx mit der ausführbaren Datei nginx.exe (z. B. nginx.exe -c conf \ nginx.conf). Unabhängig davon, welches Betriebssystem Sie verwenden, können Sie auf die Server -IP zugreifen

So lösen Sie Nginx304 Fehler So lösen Sie Nginx304 Fehler Apr 14, 2025 pm 12:45 PM

Antwort auf die Frage: 304 Nicht geänderter Fehler gibt an, dass der Browser die neueste Ressourcenversion der Client -Anfrage zwischengespeichert hat. Lösung: 1. Löschen Sie den Browser -Cache; 2. Deaktivieren Sie den Browser -Cache; 3. Konfigurieren Sie Nginx, um den Client -Cache zu ermöglichen. 4. Überprüfen Sie die Dateiberechtigungen; 5. Datei Hash prüfen; 6. Deaktivieren Sie CDN oder Reverse Proxy -Cache; 7. Starten Sie Nginx neu.

Wie kann ich überprüfen, ob Nginx begonnen wird? Wie kann ich überprüfen, ob Nginx begonnen wird? Apr 14, 2025 pm 12:48 PM

Verwenden Sie unter Linux den folgenden Befehl, um zu überprüfen, ob Nginx gestartet wird: SystemCTL -Status Nginx Richter basierend auf der Befehlsausgabe: Wenn "aktiv: aktiv (lief) angezeigt wird, wird Nginx gestartet. Wenn "Active: Inactive (Dead)" angezeigt wird, wird Nginx gestoppt.

So lösen Sie Nginx403 So lösen Sie Nginx403 Apr 14, 2025 am 10:33 AM

Wie fixiere ich Nginx 403 Verbotener Fehler? Überprüfen Sie die Datei- oder Verzeichnisberechtigungen; 2.Htaccess -Datei prüfen; 3. Überprüfen Sie die Konfigurationsdatei der Nginx; 4. Starten Sie Nginx neu. Weitere mögliche Ursachen sind Firewall -Regeln, Selinux -Einstellungen oder Anwendungsprobleme.

So starten Sie Nginx unter Linux So starten Sie Nginx unter Linux Apr 14, 2025 pm 12:51 PM

Schritte zum Starten von Nginx unter Linux: Überprüfen Sie, ob Nginx installiert ist. Verwenden Sie SystemCTL Start Nginx, um den Nginx -Dienst zu starten. Verwenden Sie SystemCTL aktivieren NGINX, um das automatische Start von NGINX beim Systemstart zu aktivieren. Verwenden Sie den SystemCTL -Status NGINX, um zu überprüfen, ob das Startup erfolgreich ist. Besuchen Sie http: // localhost in einem Webbrowser, um die Standard -Begrüßungsseite anzuzeigen.

See all articles