当前位置: 首页 > 工具软件 > cgit > 使用案例 >

cgit nginx 配置

花欣然
2023-12-01

kevin@kevin:/mnt/shared$ cat /etc/nginx/sites-available/cgit

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 8080 default_server;
    listen [::]:8080 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/htdocs/cgit;

    server_name cgit;
    location ~* ^.+\.(css|png|ico)$ {
        expires 30d;
    }

    location / {
        index cgit.cgi;
        fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
        fastcgi_param HTTP_HOST $server_name;
        fastcgi_param PATH_INFO $uri;
        fastcgi_param QUERY_INFO $uri;
        include "fastcgi_params";
    }
    access_log /var/log/nginx/cgit_access.log;
    error_log /var/log/nginx/cgit_error.log warn;

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #   include snippets/fastcgi-php.conf;
    #
    #   # With php7.0-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
    #   # With php7.0-fpm:
    #   fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    #}

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


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

kevin@kevin:/mnt/shared$ cat /etc/cgitrc

virtual-root=/
enable-index-links=1
enable-log-filecount=1
enable-log-linecount=1
snapshots=tar.gz tar.bz zip
enable-commit-graph=1
enable-subject-links=1
enable-http-clone=1
enable-http-clone=0
root-desc=Git repositories hosted project
root-title=git repositories

repo.url=Test.git
repo.path=/home/kevin/repo/Test.git
repo.desc=Test Repo
repo.owner=Kevin
 类似资料: