Skip to content

Nginx

域名替换

server {
        listen 80;
        server_name www.ooofeng.cn ooofeng.cn oufeng.cc www.oufeng.cc;
        rewrite ^(.*)$ https://$host$1;
        location / {
            index index.php index.html index.htm;
        }
    }

转发到其他端口

server {
        listen 80;
        server_name w.ooofeng.cn o.ooofeng.cn;
        location / {
            proxy_pass http://127.0.0.1:7001;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

php配置

linux

location ~ \.php$ {
        root            /web/wordpress;
        try_files       $uri =404;
        # fastcgi_pass  unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_pass    unix:/run/php/php-fpm.sock;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }

windows

location ~ \.php$ {
        fastcgi_pass    127.0.0.1:9000;
        fas
        tcgi_index  index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }

文件服务器

server {
        listen 7777;
        root E:/Temp;
        autoindex on;
        autoindex_exact_size off;
        autoindex_local
        time on;
    }

设置所有监听接口

listen       80 default_server;
listen       [::]:80 default_server;
server_name  _;