以下是一个 CentOS 7.6 的初始 nginx.conf 文件的示例:

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

events {
    worker_connections 1024;
}

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

    log_format main '$remote_addr - $remote_user [$time_local] '$request' ' 
                    '$status $body_bytes_sent '$http_referer' ' 
                    '$http_user_agent' '$http_x_forwarded_for';

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

    sendfile on;

    keepalive_timeout 65;

    #gzip on;

    server {
        listen 80;
        server_name example.com;
        root /usr/share/nginx/html;
        index index.html;

        location / {
            try_files $uri $uri/ =404;
        }
    }
}

请注意,此示例仅包含一个简单的 HTTP 服务器块,用于监听端口 80 并提供静态文件。你需要根据你的具体需求对其进行修改。

CentOS 7.6 初始 Nginx 配置文件示例

原文地址: https://www.cveoy.top/t/topic/mueg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录