Показаны сообщения с ярлыком Apache2. Показать все сообщения
Показаны сообщения с ярлыком Apache2. Показать все сообщения

среда, 13 января 2016 г.

htacess image not found resolver for modern frameworks



.htaccess :

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(gif|jpe?g|png|bmp) /image404.php [L]
</IfModule>


image404.php :

<?php
header("HTTP/1.0 404 Not Found");
exit;

понедельник, 5 октября 2015 г.

No Index No Robots

a2enmod header



<IfModule mod_headers.c>

Header set X-Robots-Tag: "noindex, nofollow, noarchive, nosnippet, noimageindex"

</IfModule>
++++
<<<<

https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04


chown -R apache:apache sites/default/files
chmod -R 775 sites/default/files

пятница, 16 января 2015 г.

Symfony2 Nginx and Apache2

Nginx Conf

server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /PATH_TOSYMFONY_PROJECT/web;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {
            try_files $uri /app.php$uri$is_args$query_string;
        }

        #
        # Pass (app|app_dev|config).php to apache2
        #
        location ~ ^/(app|app_dev|config)\.php(/|$) {
                #DMZ Only
                #Default Port
                set $_port 80;
                if ($host = EXTERNAL_IP) {
                    set $_port 10880;
                }

                if ($host = INTERNAL_IP) {
                    set $_port 80;
                }
                #End For DMZ
                proxy_pass          http://127.0.0.1:81;
                proxy_set_header    X-Real-IP  $remote_addr;

                proxy_set_header    X-Forwarded-For $remote_addr;
                proxy_set_header    X-Forwarded-Proto $scheme;

                #
                # Нужно для того чтобы симфони могло генерировать урлы без "app.php"
                #
                proxy_set_header    X-Rewrite-URL $request_uri;
                proxy_set_header    X-Original-URL $request_uri;
                proxy_set_header    X-Original-Addr $remote_addr;

                proxy_set_header    Host $host:$_port;

        }

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


Apache2 conf

<VirtualHost *:81>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/PATH_TOSYMFONY_PROJECT/web"
    DirectoryIndex app.php

    <IfModule env_module>
        SetEnv APPLICATION_ENV development
    </IfModule>

    <Directory "/PATH_TOSYMFONY_PROJECT/web">
        AllowOverride None
        Allow from All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>