반응형

Apache UserDir 모듈

 

Apache 서버의 내부 사용자들이 외부에 공개하고자 하는 html 문서를 저장하기 위한 용도로 사용되는 내부 사용자별 디렉터리를 말한다.  UserDir 모듈 사용방법은 아래와 같이 사용한다. 


1. userdir.conf 편집

 

#/etc/apache2/mods-available/userdir.conf

 

<IfModule mod_userdir.c>

          UserDir public_html    // 사용자별 디렉터리 이름

          UserDir disabled root  // userdir 모듈 허용 / 거부 설정 

         

          <Directory /home/*/public_html> // 사용자별 디렉터리 위치

                  AllowOverride FileInfo AuthConfig Limit Indexes

                  Options Multiviews Indexes SymLinksIfOwnerMatch IncludesNoExec

                  <Limit GET POST OPTIONS>

                         Order allow,deny

                         Allow from all

                  </Limit>

                  <LimitExcept GET POST OPTIONS>

                         Order deny,allow

                         Deny from all

                  </LimitExcept>

              </Directory>

</IfModule>

 

위에서 살펴본 userdir.conf파일을 이용하여특정 사용자만 UserDir 디렉터리를 허용시키고자 할 때는 enabled을 사용하여아래와 같이 설정한다.

 

) UserDir disabled

    UserDir enabled user1 user2

 

대부분의 사용자는 허용하고 일부만 거부하고자 한다면 disabled을 이용하여아래와 같이 설정한다.

 

) UserDir enabled

    UserDir disabled user1 user2 

 

2. 링크 또는 복사


Userdir.conf 파일 설정이 완료되면, /etc/apache2/mods-acailable/안에 있는 userdir.cof

userdir.load 파일을 /etc/apache2/modes-enabled/으로 복사하거나 링크를 걸어 준다.

 

링크

#cd /etc/apache2/modes-enabled/

#ln -s /etc/apache2/mods-available/userdir.conf

#ln -s /etc/apache2/mods-available/userdir.load

 

복사

#cp /etc/apache2/modes-available/userdir.* /etc/apache2/modes-enabled/

 

3. 폴더 생성

 

2번 까지 모두 완료되었으면이제 Home 디렉터리에 존재하는 사용자 폴더 밑에 public_html 폴더를 생성 후 안에 *.html 을 생성 해준다

 

4. 모든 설정이 끝났다이제 apache 데몬을 재 시작한다.


#/etc/init.d/apache2 restart

 

- Userdir 접속 방법

브라우저에서 http://도메인/~사용자/ (http://ex.com/~user1/)

반응형
반응형

외부에서 불법 링크를 차단 할 경우 (내부링크는 허용됨)
apache virtualhost부분에 아래 추가

   SetEnvIFNoCase Referer "daum.com" link_allow
   SetEnvIFNoCase Referer "111.111.13.111" link_allow - localhost를 지정해주지 않으면 IP로 접속시 이미지 깨짐
   <FilesMatch "\.(gif|jpg|)$"> - gif|jpg 지정할 경우 웹페이지중 gif 및 jpg는 외부링크는 허용안됨 추가로 확장자 지정됨
ex> (gif|jpg|png|bmp|zip|tar|rar|alz|a00|ace|jpg|jpeg|txt|GIF|JPG|BMP|ZIP|TAR|RAR|ALZ|A00|ACE|TXT|mp3|MP3|mpeg|MPEG|wav|WAV|asf|ASF|wmv|WMV|swf|SWF|exe|EXE)$">
   order allow,deny
   allow from env=link_allow
   deny from all
 </FilesMatch>


 <VirtualHost *:80>
   # ServerAdmin webmaster@daum.or.kr
    DocumentRoot /home/public_html/
    ServerName daum.com
    ServerAlias www.daum.com
    SetEnvIf Request_URI \.gif image-request
    SetEnvIf Request_URI \.jpg image-request
    SetEnvIf Request_URI \.png image-request
    CustomLog logs/access_log common env=!image-request
    #ErrorLog "logs/damc.or.kr-error_log"
    #CustomLog "logs/damc.or.kr-access_log" common

    <FilesMatch "\.(gif|jpg|png|bmp|zip|tar|rar|alz|a00|ace|jpg|jpeg|txt|GIF|JPG|BMP|ZIP|TAR|RAR|ALZ|A00|ACE|TXT|mp3|MP3|mpeg|MPEG|wav|WAV|asf|ASF|wmv|WMV|swf|SWF|exe|EXE)$">
  order allow,deny
  allow from env=link_allow
  deny from all
 </FilesMatch>
</VirtualHost>

 

반응형
반응형

.foo {

   background-size: auto 100%;
}

 

반응형
반응형
$({deg: 0}).animate({deg: d},{
     duration: cf.duration,
     step: function(now) {
      ev.css({
       transform: 'rotate(' + now + 'deg)'
      });
     }
    });

 

반응형
반응형

 

css3-mediaquery 보다 훨씬 빠르고 잘된다.

 

Respond.js

A fast & lightweight polyfill for min/max-width CSS3 Media Queries (for IE 6-8, and more)

  • Copyright 2011: Scott Jehl, scottjehl.com

  • Licensed under the MIT license.

The goal of this script is to provide a fast and lightweight (3kb minified / 1kb gzipped) script to enable responsive web designs in browsers that don't support CSS3 Media Queries - in particular, Internet Explorer 8 and under. It's written in such a way that it will probably patch support for other non-supporting browsers as well (more information on that soon).

If you're unfamiliar with the concepts surrounding Responsive Web Design, you can read up here and also here

Demo page (the colors change to show media queries working)

Usage Instructions

  1. Craft your CSS with min/max-width media queries to adapt your layout from mobile (first) all the way up to desktop

    @media screen and (min-width: 480px){
        ...styles for 480px and up go here
    }
    
  2. Reference the respond.min.js script (1kb min/gzipped) after all of your CSS (the earlier it runs, the greater chance IE users will not see a flash of un-media'd content)

  3. Crack open Internet Explorer and pump fists in delight

CDN/X-Domain Setup

Respond.js works by requesting a pristine copy of your CSS via AJAX, so if you host your stylesheets on a CDN (or a subdomain), you'll need to upload a proxy page to enable cross-domain communication.

See cross-domain/example.html for a demo:

  • Upload cross-domain/respond-proxy.html to your external domain
  • Upload cross-domain/respond.proxy.gif to your origin domain
  • Reference the file(s) via <link /> element(s):
    <!-- Respond.js proxy on external server -->
    <link href="http://externalcdn.com/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />

    <!-- Respond.js redirect location on local server -->
    <link href="/path/to/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />

    <!-- Respond.js proxy script on local server -->
    <script src="/path/to/respond.proxy.js"></script>

If you are having problems with the cross-domain setup, make sure respond-proxy.html does not have a query string appended to it.

Note: HUGE thanks to @doctyper for the contributions in the cross-domain proxy!

Support & Caveats

Some notes to keep in mind:

  • This script's focus is purposely very narrow: only min-width and max-width media queries and all media types (screen, print, etc) are translated to non-supporting browsers. I wanted to keep things simple for filesize, maintenance, and performance, so I've intentionally limited support to queries that are essential to building a (mobile-first) responsive design. In the future, I may rework things a bit to include a hook for patching-in additional media query features - stay tuned!

  • Browsers that natively support CSS3 Media Queries are opted-out of running this script as quickly as possible. In testing for support, all other browsers are subjected to a quick test to determine whether they support media queries or not before proceeding to run the script. This test is now included separately at the top, and uses the window.matchMedia polyfill found here: https://github.com/paulirish/matchMedia.js . If you are already including this polyfill via Modernizr or otherwise, feel free to remove that part.

  • This script relies on no other scripts or frameworks (aside from the included matchMedia polyfill), and is optimized for mobile delivery (~1kb total filesize min/gzip)

  • As you might guess, this implementation is quite dumb in regards to CSS parsing rules. This is a good thing, because that allows it to run really fast, but its looseness may also cause unexpected behavior. For example: if you enclose a whole media query in a comment intending to disable its rules, you'll probably find that those rules will end up enabled in non-media-query-supporting browsers.

  • Respond.js doesn't parse CSS referenced via @import, nor does it work with media queries within style elements, as those styles can't be re-requested for parsing.

  • Due to security restrictions, some browsers may not allow this script to work on file:// urls (because it uses xmlHttpRequest). Run it on a web server.

  • If the request for the CSS file that includes MQ-specific styling is behind a redirect, Respond.js will fail silently. CSS files should respond with a 200 status.

  • Currently, media attributes on link elements are supported, but only if the linked stylesheet contains no media queries. If it does contain queries, the media attribute will be ignored and the internal queries will be parsed normally. In other words, @media statements in the CSS take priority.

  • Reportedly, if CSS files are encoded in UTF-8 with Byte-Order-Mark (BOM), they will not work with Respond.js in IE7 or IE8. Noted in issue #97

  • WARNING: Including @font-face rules inside a media query will cause IE7 and IE8 to hang during load. To work around this, place @font-face rules in the wide open, as a sibling to other media queries.

  • If you have more than 32 stylesheets referenced, IE will throw an error, Invalid procedure call or argument. Concatenate your CSS and the issue should go away.

  • Sass/SCSS source maps are not supported; @media -sass-debug-info will break respond.js. Noted in issue #148

  • Internet Explorer 9 supports css3 media queries, but not within frames when the CSS containing the media query is in an external file (this appears to be a bug in IE9 — see http://stackoverflow.com/questions/10316247/media-queries-fail-inside-ie9-iframe). See this commit for a fix if you're having this problem. https://github.com/NewSignature/Respond/commit/1c86c66075f0a2099451eb426702fc3540d2e603

  • Nested Media Queries are not supported

How's it work?

Basically, the script loops through the CSS referenced in the page and runs a regular expression or two on their contents to find media queries and their associated blocks of CSS. In Internet Explorer, the content of the stylesheet is impossible to retrieve in its pre-parsed state (which in IE 8-, means its media queries are removed from the text), so Respond.js re-requests the CSS files using Ajax and parses the text response from there. Be sure to configure your CSS files' caching properly so that this re-request doesn't actually go to the server, hitting your browser cache instead.

From there, each media query block is appended to the head in order via style elements, and those style elements are enabled and disabled (read: appended and removed from the DOM) depending on how their min/max width compares with the browser width. The media attribute on the style elements will match that of the query in the CSS, so it could be "screen", "projector", or whatever you want. Any relative paths contained in the CSS will be prefixed by their stylesheet's href, so image paths will direct to their proper destination

API Options?

Sure, a couple:

  • respond.update() : rerun the parser (helpful if you added a stylesheet to the page and it needs to be translated)
  • respond.mediaQueriesSupported: set to true if the browser natively supports media queries.
  • respond.getEmValue() : returns the pixel value of one em

Alternatives to this script

This isn't the only CSS3 Media Query polyfill script out there; but it damn well may be the fastest.

If you're looking for more robust CSS3 Media Query support, you might check out http://code.google.com/p/css3-mediaqueries-js/. In testing, I've found that script to be noticeably slow when rendering complex responsive designs (both in filesize and performance), but it really does support a lot more media query features than this script. Big hat tip to the authors! :)

 

반응형

'웹프로그래밍 > CSS' 카테고리의 다른 글

IE에서 input text 박스 x 버튼 숨기기  (0) 2015.09.08
background-size cover only Y ?  (0) 2015.05.08
Background-size for IE7,8  (0) 2015.04.24
CSS3 구조선택자  (0) 2015.04.24
CSS 동위선택자, 상태선택자  (0) 2015.04.24
반응형

https://github.com/louisremi/background-size-polyfill

 

 for IE8 that is really simple to use:

 

.selector {
background-size: cover;
behavior: url(/backgroundsize.min.htc);
}

 

반응형

'웹프로그래밍 > CSS' 카테고리의 다른 글

background-size cover only Y ?  (0) 2015.05.08
CSS3 for IE7, 8 {https://github.com/scottjehl/Respond/}  (0) 2015.04.27
CSS3 구조선택자  (0) 2015.04.24
CSS 동위선택자, 상태선택자  (0) 2015.04.24
CSS 속성선택자  (0) 2015.04.24
반응형

구조선택자는 CSS3에서 추가된 기능이므로 IE8 이하에서는 사용할 수 없다.


1. 일반 구조 선택자

 선택자 형태

설명 

  :first-child

첫번째에 위치하는 자손을 선택

  :last-child

마지막에 위치하는 자손을 선택

  :nth-child(수열)

앞에서 수열 번째에 있는 자손을 선택  ex) nth-child(2n) , nth-child(2n+1

  :nth-last-child(수열)

뒤에서 수열 번째에 있는 자손을 선택 

 

 

 

<style type="text/css">

li{width:100px;list-style:none;padding:10px;}

li:first-child{border-radius:10px 10px 0 0;}

li:last-child{border-radius:0 0 10px 10px;}

li:nth-child(2n){background-color:#f6529d;}

li:nth-child(2n+1){background-color:#23c8b6;}

</style>

<body>

 

<ul>

<li>first</li>

<li>second</li>

<li>third</li>

<li>fourth</li>

<li>fifth</li>

<li>sixth</li>

<li>seventh</li>

</ul>

</body>





 

 

2. 형태 구조 선택자

 선택자 형태

설명 

  :first-of-type

자손 중에 첫번째로 등장하는 특정태그

  :last-of-type

자손 중에 마지막으로 등장하는 특정태그

  :nth-of-type(수열)

자손 중에 앞에서 수열 번째로 등장하는 특정 태그 선택

  :nth-last-of-type(수열)

자손 중에 뒤에서 수열 번째로 등장하는 특정 태그 선택

 


<style type="text/css">

h1:first-of-type{color:red;}

h2:first-of-type{color:red;}

h3:last-of-type{color:blue;}

</style>

<body>

<h1>header 1</h1>

<h2>header 2</h2>

<h3>header 3</h3>

<h3>header 3</h3>

<h2>header 2</h2>

<h1>header 1</h1>

</body>

반응형
반응형

1. 동위선택자

 선택자 형태

설명 

 선택자A + 선택자B 

선택자A 바로 뒤에 위치하는 선택자B 선택 

 선택자A ~ 선택자B 

선택자A뒤에 위치하는 선택자B 선택 

 


<style type="text/css">

h1+h2{color:red}

h1~h2{background-color:orange}

</style>


<h1>header-1</h1>

<h2>header-2</h2>

<h2>header-3</h2>

<h2>header-4</h2> 
 


 


 

2. 상태선택자 : 입력양식의 상태를 선택할때 사용하는 선택자

  선택자 형태

설명 

 :checked 

체크상태의 input 태그 선택

 :focus

초점이 맞추어진 input 태그 선택

 :enabled

사용가능한 input 태그 선택 

 :disabled 

사용 불가능한 input 태그 선택 

반응형

+ Recent posts