PlanetTheCloud / project-logged

Custom material design authentication template for MyOwnFreeHost
MIT License
31 stars 17 forks source link

Add Nginx Configuration to wiki if possible for 1.8.x,2.x.x #24

Closed ImLoadingUuU closed 12 months ago

ImLoadingUuU commented 1 year ago

1.8.x

#user  nobody;
worker_processes 1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;
events {
    worker_connections 1024;
}

http {
    include 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  logs/access.log  main;
    sendfile on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout 65;

    #gzip  on;

    server {
        listen <Port>;
        server_name <Host>;
        root <Logged Path>;
        index index.php index.html index.htm;

        # nginx configuration by winginx.com

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        # redirect server error pages to the static page /50x.html
        # error_page 500 502 503 504 /50x.html;
        error_page 500 /auth/error?code=500;

        error_page 404 /auth/error?code=404;

        error_page 403 /auth/error?code=403;

        location /auth {
            rewrite ^/auth/error /error.php break;
            rewrite ^/auth/api/(.*)?$ /sys-auth/api/$1.php break;
            rewrite ^/auth/(.*)?$ /sys-auth/$1.php break;
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /opt/homebrew/var/www$fastcgi_script_name; #指定路径
            include fastcgi_params;
        }
        location /auth/assets {
            rewrite ^/auth/assets/(.*)?$ /sys-auth/assets/$1 break;
            allow all;
        }

        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME <Path>$fastcgi_script_name; 
            include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
            deny all;
        }

    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    include servers/*;

}

2.x.x

  location /auth {
            rewrite ^/auth/assets/(.*)?$ /sys-auth/assets/$1 break;
            rewrite ^/auth/api/(.*)?$ /sys-auth/api/$1.php break;
            rewrite ^/auth/(.*)?$ /sys-auth/routes/$1.php break;
                try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME /opt/homebrew/var/www$fastcgi_script_name; #指定路径
          include fastcgi_params;
        }

        location /auth/assets {
            rewrite ^/auth/assets/(.*)?$ /sys-auth/assets/$1 break;
            allow all;
        }

        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /opt/homebrew/var/www$fastcgi_script_name; #指定路径
            include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
            deny all;
        }
PlanetTheCloud commented 1 year ago

Whoa, is it supposed to be that long? and would you mind changing the language to English?

ImLoadingUuU commented 1 year ago

ok smaller

Whoa, is it supposed to be that long? and would you mind changing the language to English?

2.x.x

  location /auth {
            rewrite ^/auth/assets/(.*)?$ /sys-auth/assets/$1 break;
            rewrite ^/auth/api/(.*)?$ /sys-auth/api/$1.php break;
            rewrite ^/auth/(.*)?$ /sys-auth/routes/$1.php break;
                try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME <FastCGI Path>$fastcgi_script_name; #FastCGI
          include fastcgi_params;
        }

        location /auth/assets {
            rewrite ^/auth/assets/(.*)?$ /sys-auth/assets/$1 break;
            allow all;
        }

        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME <FastCGI Path>$fastcgi_script_name; #FastCGI
            include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
            deny all;
        }

1.8.x

  location /auth {
            rewrite ^/auth/error /error.php break;
            rewrite ^/auth/api/(.*)?$ /sys-auth/api/$1.php break;
            rewrite ^/auth/(.*)?$ /sys-auth/$1.php break;
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME <Path>$fastcgi_script_name; #FastCGI
            include fastcgi_params;
        }
        location /auth/assets {
            rewrite ^/auth/assets/(.*)?$ /sys-auth/assets/$1 break;
            allow all;
        }

        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME <Path>$fastcgi_script_name; 
            include fastcgi_params;
        }
PlanetTheCloud commented 1 year ago

Okay, I actually never configured NGiX myself, where would these be placed? Can it be a places as a file like .htaccess?

PlanetTheCloud commented 1 year ago

Need an update on this, please add instructions on how to implement this.

PlanetTheCloud commented 1 year ago

@ImLoadingUuU

ImLoadingUuU commented 1 year ago

just add that to nginx.conf

4yx commented 1 year ago

just add that to nginx.conf

This should just be added as an article to the wiki then, or a file somewhere in the repo?

PlanetTheCloud commented 1 year ago

I think it's best to put it in Wiki.

PlanetTheCloud commented 12 months ago

Added to wiki. Thank you.