명령줄에서 ".htaccess"를 테스트하는 방법

명령줄에서 ".htaccess"를 테스트하는 방법

아파치 간헐적으로 안되는 원인을 찾아보려고 합니다.인터넷 서버 오류MediaWiki 편집 및 업로드 중. 일부 소식통에서는 오류를 확인하라고 말합니다 .htaccess.

다음을 통해 검토 할 수 있습니다 .htaccess.

sudo find /var -name '.htaccess' -exec ls -al {} \;

그런데 이 파일을 테스트하기 위한 Apache 명령이 무엇인지 모르겠습니다 .htaccess. 즉, -exec섹션에 무엇을 삽입해야 할지 알 수 없습니다 find.

나는 이것을 보고 apachectl시도했지만 apachectl test막다른 골목처럼 보입니다.

$ apachectl test
Usage: /usr/sbin/httpd [-D name] [-d directory] [-f file]
                       [-C "directive"] [-c "directive"]
                       [-k start|restart|graceful|graceful-stop|stop]
                       [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed vhost settings
  -t -D DUMP_RUN_CFG : show parsed run settings
  -S                 : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
  -t -D DUMP_MODULES : show all loaded modules 
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check
  -X                 : debug mode (only one worker, do not detach)

SSH를 통해 상자에 액세스할 수 있으며 이것이 유지 관리를 수행하는 방법입니다. 사용할 수 있는 브라우저는 없지만 필요한 경우 lynx를 사용할 수 있습니다.

.htaccess명령줄에서 아래에 표시된 다양한 항목을 어떻게 테스트할 수 있나요 ?


$ sudo find /var -name '.htaccess' -exec ls -l {} \;
-rw-r----- 1 root apache 180 Aug  9  2015 /var/www/html/wiki/images/.htaccess
-rw-r----- 1 root apache 14 Aug  9  2015 /var/www/html/wiki/images/deleted/.htaccess
-rw-r----- 1 root apache 14 May 25  2015 /var/www/html/wiki/languages/.htaccess
-rw-r----- 1 root apache 14 May 25  2015 /var/www/html/wiki/serialized/.htaccess
-rw-r----- 1 root apache 14 May 25  2015 /var/www/html/wiki/cache/.htaccess
-rw-r----- 1 root apache 14 May 25  2015 /var/www/html/wiki/includes/.htaccess
-rw-r----- 1 root apache 14 May 25  2015 /var/www/html/wiki/maintenance/archives/.htaccess
-rw-r----- 1 root apache 14 May 25  2015 /var/www/html/wiki/maintenance/.htaccess
-rw-r----- 1 root apache 180 Aug  9  2015 /var/www/html/.htaccess

$ apachectl -v
Server version: Apache/2.4.6 (CentOS)
Server built:   May 12 2016 10:27:23

답변1

명령줄에서 .htaccess를 테스트하는 방법은 무엇입니까?

명령줄에서 HTTP 요청을 사용하지 않는 것과 정확히 같습니다.

curl(이에 국한되지 않음) 및 와 같이 이를 위해 유용한 몇 가지 일반적인 도구가 있습니다 wget. 두 도구 모두 헤더, HTTP 반환 코드 및 전체 출력을 가져오는 옵션이 포함되어 있습니다.

이를 자동 검색에 통합해야 하는 경우 다음과 같이 간단한 텍스트 교체 또는 매핑을 수행해야 합니다.

basename `dirname /var/www/www.mysite.com/public`

...산출:

www.mysite.com

귀하의 의견을 바탕으로 실제 경로를 보여주십시오 ...

echo www.yoursite.com/`dirname /var/www/html/wiki/serialized/.htaccess|cut -d/ -f5-`

...다음을 제공합니다:

www.yoursite.com/wiki/serialized

따라서 최종 명령은 다음과 같습니다.

wget $(echo www.yoursite.com/`dirname /var/www/html/wiki/serialized/.htaccess|cut -d/ -f5-`)

관련 정보