Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ===================================
- MAIN.conf
- ===================================
- server {
- #listen 80;
- #listen 443;
- #ssl on;
- #ssl_certificate /home/ssl/mycert.pem;
- #ssl_certificate_key /home/ssl/mycert.key;
- ssl_verify_client on;
- listen 80 default_server;
- listen [::]:80 default_server;
- # SSL configuration
- listen 443 ssl default_server;
- listen [::]:443 ssl default_server;
- root /var/www/html;
- # Add index.php to the list if you are using PHP
- index index.html index.php;
- server_name [site].me;
- # hack for having custom error pages with images
- error_page 404 /error/404.html;
- error_page 500 502 503 504 /error/50x.html;
- location ^~ /error/ {
- alias /usr/share/nginx/errorPages/;
- internal;
- allow all;
- auth_basic off;
- }
- location ^~ /errorassets/ {
- alias /usr/share/nginx/errorPages/errorassets/;
- allow all;
- auth_basic off;
- }
- location / {
- # First attempt to serve request as file, then
- # as directory, then fall back to displaying a 404.
- try_files $uri $uri/ =404;
- }
- # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
- #
- location ~ \.php$ {
- include snippets/fastcgi-php.conf;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- }
- # deny access to .htaccess files, if Apache's document root
- # concurs with nginx's one
- location ~ /\.ht {
- deny all;
- }
- }
- ===================================
- GIT1.conf
- ===================================
- upstream gitlab-workhorse {
- server unix://var/opt/gitlab/gitlab-workhorse/socket fail_timeout=0;
- }
- server {
- listen *:8080;
- server_name [site].me;
- server_tokens off;
- root /opt/gitlab/embedded/service/gitlab-rails/public;
- client_max_body_size 250m;
- access_log /var/log/gitlab/nginx/gitlab_access.log;
- error_log /var/log/gitlab/nginx/gitlab_error.log;
- # Ensure Passenger uses the bundled Ruby version
- passenger_ruby /opt/gitlab/embedded/bin/ruby;
- # Correct the $PATH variable to included packaged executables
- passenger_env_var PATH "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/usr/local/bin:/usr/bin:/bin";
- # Make sure Passenger runs as the correct user and group to
- # prevent permission issues
- passenger_user git;
- passenger_group git;
- # Enable Passenger & keep at least one instance running at all times
- passenger_enabled on;
- passenger_min_instances 1;
- location ~ ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ {
- # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
- error_page 418 = @gitlab-workhorse;
- return 418;
- }
- location ~ ^/[\w\.-]+/[\w\.-]+/repository/archive {
- # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
- error_page 418 = @gitlab-workhorse;
- return 418;
- }
- location ~ ^/api/v3/projects/.*/repository/archive {
- # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
- error_page 418 = @gitlab-workhorse;
- return 418;
- }
- # Build artifacts should be submitted to this location
- location ~ ^/[\w\.-]+/[\w\.-]+/builds/download {
- client_max_body_size 0;
- # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
- error_page 418 = @gitlab-workhorse;
- return 418;
- }
- # Build artifacts should be submitted to this location
- location ~ /ci/api/v1/builds/[0-9]+/artifacts {
- client_max_body_size 0;
- # 'Error' 418 is a hack to re-use the @gitlab-workhorse block
- error_page 418 = @gitlab-workhorse;
- return 418;
- }
- location @gitlab-workhorse {
- ## https://github.com/gitlabhq/gitlabhq/issues/694
- ## Some requests take more than 30 seconds.
- proxy_read_timeout 3600;
- proxy_connect_timeout 300;
- proxy_redirect off;
- # Do not buffer Git HTTP responses
- proxy_buffering off;
- #sub_filter_types text/html;
- #sub_filter '</head>' '\n<link rel="stylesheet" media="all" href="/custom/hexxgit.css" />\n</head>';
- proxy_set_header Host $http_host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_pass http://gitlab-workhorse;
- ## The following settings only work with NGINX 1.7.11 or newer
- #
- ## Pass chunked request bodies to gitlab-workhorse as-is
- # proxy_request_buffering off;
- # proxy_http_version 1.1;
- }
- ## Enable gzip compression as per rails guide:
- ## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
- ## WARNING: If you are using relative urls remove the block below
- ## See config/application.rb under "Relative url support" for the list of
- ## other files that need to be changed for relative url support
- location ~ ^/(assets)/ {
- root /opt/gitlab/embedded/service/gitlab-rails/public;
- gzip_static on; # to serve pre-gzipped version
- expires max;
- add_header Cache-Control public;
- }
- location / {
- # substitute just HTML items
- #sub_filter_types text/html;
- # replace the closing <head> tag with our custom CSS and JS
- sub_filter '</head>' '\n<link rel="stylesheet" media="all" href="/custom/hexxgit.css" />\n</head>';
- # proxy all requests to the host `gitlab` this might be the only thing that needs to be customize in other setups
- #proxy_pass http://gitlab;
- # set the Host: header exactly how it was called
- #proxy_set_header Host $host;
- # don't let gitlab serve Nginx compressed (gzip/etc) since it won't be replaced above since the mime type won't match
- #proxy_set_header Accept-Encoding "";
- }
- error_page 502 /502.html;
- }
- ===================================
- GIT2.conf
- ===================================
- server {
- listen 80;
- server_name git.hexxon.me;
- location / {
- proxy_pass http://localhost:8080;
- }
- }r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement