working on it ...


Explore Public Snippets

Sort by

Found 580 snippets

    public by cbbeny  1476  3  5  0

    Change root folder via htaccess

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^$
    RewriteCond %{REQUEST_URI} !folder/
    RewriteRule (.*) /folder/$1 [L]

    public by cbbeny  2732  0  5  0

    Redirect website to https

    RewriteEngine On
    RewriteCond %{HTTP:HTTPS} !on [NV]
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    public by bkozora  655  0  3  0

    Apache - Wildcard Subdomains

    Apache - Wildcard Subdomains: vhosts.conf
    DocumentRoot "/var/www/vhosts"
    <Directory "/var/www/vhosts">
        Options Indexes FollowSymLinks ExecCGI
        AllowOverride All
        Order allow,deny 
        Allow from all
        #Require all granted 
    <VirtualHost *:80>
        VirtualDocumentRoot /var/www/vhosts/%1/www/
        ServerAlias *

    external by Jake  2  0  1  0

    Aliases for apache and venv

    Aliases for apache and venv: Bash aliases
    alias ll='ls -alF'
    alias la='ls -A'
    alias l='ls -CF'
    alias apalog='sudo cat /var/log/apache2/error.log'
    alias aparest='sudo /etc/init.d/apache2 restart'
    alias apastop='sudo /etc/init.d/apache2 stop'
    alias apastart='sudo /etc/init.d/apache2 start'
    alias actenv='source /home/ubuntu/venv/bin/activate'
    alias atail='sudo tail -f /var/log/apache2/error.log'

    external by Manolo Torres  4  0  2  0

    Dockerfile para PHP, Apache y Phalcon

    Dockerfile para PHP, Apache y Phalcon: PhalconDockerfile
    FROM ubuntu:16.04
    ENV DEBIAN_FRONTEND=noninteractive
    RUN apt-get update && apt-get install -yq --no-install-recommends \
        apt-utils \
        curl \
        # Install git
        git \
        # Install apache
        apache2 \
        # Install php 7.2
        php \
        libapache2-mod-php \
        php-mcrypt \
        php-mysql \
        php-curl \
        nano \
        ca-certificates \
        locales \
        && apt-get clean && rm -rf /var/lib/apt/lists/*
    RUN curl -s "" | /bin/bash
    RUN apt-get install -y php7.0-phalcon
    # Set locales
    RUN locale-gen en_US.UTF-8 en_GB.UTF-8 es_ES.UTF-8 
    COPY conf/apache2.conf /etc/apache2/apache2.conf
    COPY conf/dir.conf /etc/apache2/mods-available/dir.conf
    RUN a2enmod rewrite
    RUN service apache2 restart
    EXPOSE 80 443
    WORKDIR /var/www/html
    RUN rm /var/www/html/index.html
    HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD curl -f http://localhost || exit 1
    CMD apachectl -D FOREGROUND 

    external by Github  3  0  1  0

    Apache root file .htaccess

    Apache root file .htaccess: htaccess
    RewriteEngine On
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?url=$1
    <FilesMatch "\.(ttf|ttc|otf|eot|woff)$">
        <IfModule mod_headers.c>
            Header set Access-Control-Allow-Origin "*"
    <IfModule mod_deflate.c>
    # Insert filter
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/atom_xml
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-httpd-php
    AddOutputFilterByType DEFLATE application/x-httpd-fastphp
    AddOutputFilterByType DEFLATE application/x-httpd-eruby
    AddOutputFilterByType DEFLATE text/html
    SetOutputFilter DEFLATE
    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    # MSIE masquerades as Netscape, but it is fine
    # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
    # the above regex won't work. You can use the following
    # workaround to get the desired effect:
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    # Don't compress images
    SetEnvIfNoCase Request_URI \
    \.(?:gif|jpe?g|png)$ no-gzip dont-vary
    # Compressão dos arquivos listados abaixo
    <ifModule mod_deflate.c>
        <filesMatch "\.(js|css|html|php)$">
            AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
    # Ou comprimir certos ficheiros por extenção:
    <Files *.html>
    SetOutputFilter DEFLATE
    # Aproveitando o cache do navegador
    #Força a utilizar Cache-Control e Expires header
    <IfModule mod_headers.c>
      Header unset ETag
    FileETag None
    <IfModule mod_expires.c>
     ExpiresActive on
     ExpiresDefault "access plus 1 month"
     ExpiresByType text/cache-manifest "access plus 0 seconds"
     # Html
     ExpiresByType text/html "access plus 0 seconds"
     # Data
     ExpiresByType text/xml "access plus 0 seconds"
     ExpiresByType application/xml "access plus 0 seconds"
     ExpiresByType application/json "access plus 0 seconds"
     # Feed
     ExpiresByType application/rss+xml "access plus 1 hour"
     ExpiresByType application/atom+xml "access plus 1 hour"
     # Favicon
     ExpiresByType image/x-icon "access plus 1 week"
     # Media: images, video, audio
     ExpiresByType image/gif "access plus 1 month"
     ExpiresByType image/png "access plus 1 month"
     ExpiresByType image/jpg "access plus 1 month"
     ExpiresByType image/jpeg "access plus 1 month"
     ExpiresByType video/ogg "access plus 1 month"
     ExpiresByType audio/ogg "access plus 1 month"
     ExpiresByType video/mp4 "access plus 1 month"
     ExpiresByType video/webm "access plus 1 month"
     # HTC files
     ExpiresByType text/x-component "access plus 1 month"
     # Webfonts
     ExpiresByType application/x-font-ttf "access plus 1 month"
     ExpiresByType font/opentype "access plus 1 month"
     ExpiresByType application/x-font-woff "access plus 1 month"
     ExpiresByType image/svg+xml "access plus 1 month"
     ExpiresByType application/ "access plus 1 month"
     # CSS / JS
     ExpiresByType text/css "access plus 1 year"
     ExpiresByType application/javascript "access plus 1 year"
     ExpiresByType application/x-javascript  "access plus 1 year"
    #Força o IE a sempre carregar utilizando a última versão disponível
    <IfModule mod_headers.c>
      Header set X-UA-Compatible "IE=Edge,chrome=1"
      <FilesMatch "\.(js|css|gif|png|jpeg|pdf|xml|oga|ogg|m4a|ogv|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|oex|xpi|safariextz|vcf)$" >
        Header unset X-UA-Compatible

    external by syci  10  0  1  0

    Apache2 Odoo Config

    Apache2 Odoo Config: odoo.conf
    <VirtualHost *:443>
       SSLEngine on
       SSLProtocol           all -SSLv2 -SSLv3
       SSLCipherSuite        ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
       SSLCertificateFile    /etc/ssl/
       SSLCertificateKeyFile /etc/ssl/
       RequestHeader set X-Forwarded-Proto "https"
       <IfModule mod_rewrite.c>
          RewriteEngine On
          # Permanent redirect (301 HTTP) if no canonical domain name
          RewriteCond %{HTTP_HOST} !^
          RewriteRule ^/(.*)$$1 [R=301,NE,L]
       <Location "/" >
          Order deny,allow
          Deny from all
          Allow from all
       <Location "/web/database/manager" >
          Order deny,allow
          Deny from all
          Allow from ::1/128
       <Location "/website/info" >
          Order deny,allow
          Deny from all
          Allow from ::1/128
       # Comment to disable proxy
       ProxyRequests Off
       ProxyPreserveHost On
       ProxyPass /longpolling/        http://localhost:8072/longpolling/ retry=0
       ProxyPassReverse /longpolling/ http://localhost:8072/longpolling/ retry=0
       ProxyPass /                    http://localhost:8069/ retry=0
       ProxyPassReverse /             http://localhost:8069/ retry=0
       ErrorLog /var/log/apache2/
       LogLevel warn
       CustomLog /var/log/apache2/ combined

    external by Rigel Kent  8  0  1  0

    An opinionated httpd/Apache vhost to run PeerTube, following Mozilla's modern security practices as of

    An opinionated httpd/Apache vhost to run PeerTube, following Mozilla's modern security practices as of peertube.conf
    # It's generally not a good idea to broadcast the version of Apache you run
    ServerSignature Off
    ServerTokens Prod
    # Security configuration
    SSLCipherSuite                    EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
    SSLProtocol                       All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
    SSLHonorCipherOrder               on
    # Requires Apache >= 2.4
    SSLCompression                    off
    # To use stapling, we have to enable it globally
    SSLStaplingCache                  "shmcb:logs/stapling-cache(150000)"
    # OCSP Stapling requires Apache >= 2.3.3
    SSLUseStapling                    on
    SSLStaplingResponderTimeout       5
    SSLStaplingReturnResponderErrors  off
    SSLSessionTickets                 off # Requires Apache >= 2.4.11
    <VirtualHost *:80 [::]:80>
            Protocols h2c http/1.1
    				RewriteEngine On
            RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
            RewriteCond %{HTTPS} off
            RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
            Alias /.well-known/acme-challenge/ /var/www/certbot/
            <Directory /var/www/certbot>
                    Options None
                    AllowOverride None
                    ForceType text/plain
                    RedirectMatch 404 "^(?!/\.well-known/acme-challenge/[\w-]{43}$)"
                    Require method GET POST OPTIONS
            ErrorLog "/var/log/httpd/"
            CustomLog "/var/log/httpd/" common env=!dontlog
    <VirtualHost *:443 [::]:443>
            Protocols h2 http/1.1
            SSLEngine on
            # For example with certbot (you need a certificate to run https)
            SSLCertificateFile /etc/letsencrypt/live/
            SSLCertificateKeyFile /etc/letsencrypt/live/
            # HSTS (mod_headers is required) (63072000 seconds = 2 years)
            Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
            Header always set X-Frame-Options DENY
            Header always set X-Content-Type-Options nosniff
            Header always set X-Robots-Tag none
            Header always set X-XSS-Protection "1; mode=block"
            # Hard limit, PeerTube does not support videos > 4GB
            LimitRequestBody 4294967294
            # Set caching on assets for 1 year
            <FilesMatch ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$>
                    Header append Cache-Control "public, max-age=31536000, immutable"
            AliasMatch ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ /var/www/peertube/peertube-latest/client/dist/$1
            # Set caching on image files for 1 year
            <FilesMatch ^/static/(thumbnails|avatars)/(.*)$>
                    Header append Cache-Control "public, max-age=31536000, immutable"
            AliasMatch ^/static/(thumbnails|avatars)/(.*)$ /var/www/peertube/storage/$1/$2
            # Bypass PeerTube webseed route for better performances
            Alias /static/webseed /var/www/peertube/storage/videos
            <Location /static/webseed>
                    # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
                    SetOutputFilter RATE_LIMIT
                    SetEnv rate-limit 800
                    <Limit GET>
                            Header always set Access-Control-Allow-Origin "*"
                            Header always set Access-Control-Allow-Headers "Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type"
                            Header always set Access-Control-Allow-Methods "GET, OPTIONS"
                            # Don't spam access log file with byte range requests
                            SetEnv dontlog
                    <Limit OPTIONS>
                            Header always set Access-Control-Allow-Origin "*"
                            Header always set Access-Control-Allow-Headers "Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type"
                            Header always set Access-Control-Allow-Methods "GET, OPTIONS"
                            Header always set Access-Control-Max-Age "1000"
                            Header always set Content-Type "text/plain charset=UTF-8"
                            Header always set Content-Length "0"
                            Redirect 204
            ProxyPreserveHost On
            ProxyRequests On
            ProxyTimeout 600
            # Websocket tracker
            <Location /tracker/socket>
                    # Peers send a message to the tracker every 15 minutes
                    # Don't close the websocket before this time
                    RequestHeader set Upgrade "websocket"
                    RequestHeader set Connection "upgrade"
                    ProxyPass timeout=1200
            <Location />
            ErrorLog "/var/log/httpd/"
            CustomLog "/var/log/httpd/" common env=!dontlog

    external by KyonLi  5  0  1  0

    Apache2 websocket proxy

    Apache2 websocket proxy: websocket.conf
    <VirtualHost *:443>
         SSLEngine on
         SSLProxyEngine on
         ProxyPreserveHost on
         ProxyRequests Off
         SSLCertificateFile /etc/apache2/ssl/
         SSLCertificateKeyFile /etc/apache2/ssl/
         SSLCertificateChainFile /etc/apache2/ssl/ca.cer
         DocumentRoot /var/www/errorPages
         ErrorDocument 503 /503.html
         ProxyPass /503.html !
         ProxyPass / http://localhost:3999/
         ProxyPassReverse / http://localhost:3999/
         RewriteEngine on
         RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
         RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
         RewriteRule .* ws://localhost:3999%{REQUEST_URI} [P]

    external by Tim DeBarbora  8  0  1  0


    /etc/apache2/mods-available/status.conf: status.conf
    <Location /server-status>
    	SetHandler server-status
    	Order deny,allow
    	Deny from all
    	Allow from ::1
    	Allow from Your.IP.Address.Here
    • Public Snippets
    • Channels Snippets