working on it ...

Filters

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} ^domain-name.com$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.domain-name.com$
    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 
    </Directory>
    
    <VirtualHost *:80>
        VirtualDocumentRoot /var/www/vhosts/%1/www/
        ServerAlias *.exampledomain.com
    </VirtualHost>
    
    

    external by Jake  2  0  1  0

    Aliases for apache and venv

    Aliases for apache and venv: Bash aliases
    #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 "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | /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>
    </FilesMatch>
    
    <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
    </IfModule>
    
    # 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
        </filesMatch>
     </ifModule>
    # Ou comprimir certos ficheiros por extenção:
    <Files *.html>
    SetOutputFilter DEFLATE
    </Files>
    
    # Aproveitando o cache do navegador
    #Força a utilizar Cache-Control e Expires header
    <IfModule mod_headers.c>
      Header unset ETag
    </IfModule>
    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/vnd.ms-fontobject "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"
    </IfModule>
    #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
      </FilesMatch>
    </IfModule>
    
    

    external by syci  10  0  1  0

    Apache2 Odoo Config

    Apache2 Odoo Config: odoo.conf
    <VirtualHost *:443>
       ServerAdmin webmaster@example.com
       ServerName odoo.example.com
    
       SSLEngine on
       SSLProtocol           all -SSLv2 -SSLv3
       SSLCipherSuite        ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
       SSLCertificateFile    /etc/ssl/wildcard.example.com/public.crt
       SSLCertificateKeyFile /etc/ssl/wildcard.example.com/private.pem
    
       RequestHeader set X-Forwarded-Proto "https"
    
       <IfModule mod_rewrite.c>
          RewriteEngine On
    
          # Permanent redirect (301 HTTP) if no canonical domain name
          RewriteCond %{HTTP_HOST} !^odoo.example.com
          RewriteRule ^/(.*)$ https://odoo.example.com/$1 [R=301,NE,L]
       </IfModule>
    
       <Location "/" >
          Order deny,allow
          Deny from all
          Allow from all
       </Location>
    
       <Location "/web/database/manager" >
          Order deny,allow
          Deny from all
          Allow from 192.168.122.0/24 127.0.0.0/255.0.0.0 ::1/128
       </Location>
    
       <Location "/website/info" >
          Order deny,allow
          Deny from all
          Allow from 192.168.122.0/24 127.0.0.0/255.0.0.0 ::1/128
       </Location>
    
       # 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/odoo.example.com-ssl.error.log
       LogLevel warn
       CustomLog /var/log/apache2/odoo.example.com-ssl.access.log combined
    
    </VirtualHost>
    </IfModule>
    
    
    

    external by Rigel Kent  8  0  1  0

    An opinionated httpd/Apache vhost to run PeerTube, following Mozilla's modern security practices as of https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=apache-2.4.28&openssl=1.0.1e&hsts=yes&profile=modern

    An opinionated httpd/Apache vhost to run PeerTube, following Mozilla's modern security practices as of https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=apache-2.4.28&openssl=1.0.1e&hsts=yes&profile=modern: 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>
            ServerName peertube.example.com
            ServerAdmin webmaster@example.com
            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
            </Directory>
    
            ErrorLog "/var/log/httpd/peertube.example.com.error.log"
            CustomLog "/var/log/httpd/peertube.example.com.access.log" common env=!dontlog
    </VirtualHost>
    
    <VirtualHost *:443 [::]:443>
            ServerName peertube.example.com
            ServerAdmin webmaster@example.com
            Protocols h2 http/1.1
    
            SSLEngine on
            # For example with certbot (you need a certificate to run https)
            SSLCertificateFile /etc/letsencrypt/live/peertube.example.com/fullchain.pem
            SSLCertificateKeyFile /etc/letsencrypt/live/peertube.example.com/privkey.pem
    
            # 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"
            </FilesMatch>
            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"
            </FilesMatch>
            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>
                    <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
                    </Limit>
            </Location>
    
            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 http://127.0.0.1:9000/ timeout=1200
            </Location>
    
            <Location />
                    ProxyPass http://127.0.0.1:9000/
            </Location>
    
            ErrorLog "/var/log/httpd/peertube.example.com.error.log"
            CustomLog "/var/log/httpd/peertube.example.com.access.log" common env=!dontlog
    </VirtualHost>
    
    

    external by KyonLi  5  0  1  0

    Apache2 websocket proxy

    Apache2 websocket proxy: websocket.conf
    <VirtualHost *:443>
         ServerName mysite.com
         ServerAlias www.mysite.com
    
         SSLEngine on
         SSLProxyEngine on
         ProxyPreserveHost on
         ProxyRequests Off
    
         SSLCertificateFile /etc/apache2/ssl/mysite.com.crt
         SSLCertificateKeyFile /etc/apache2/ssl/mysite.com.key
         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]
    
    </VirtualHost>
    
    

    external by Tim DeBarbora  8  0  1  0

    /etc/apache2/mods-available/status.conf

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