본문으로 이동

사이트 등록: 두 판 사이의 차이

학교의 모든 지식. SMwiki
새 문서: == 개요 == 구글 콘솔 서치나 네이버 서치어드바이저 등에 사이트를 등록해야 검색엔진에 노출된다. == 사이트맵 == * 기본적으로 https://www.mediawiki.org/wiki/Manual:GenerateSitemap.php<nowiki/>를 참고. * 일반적으로 sitemap 디렉토리를 만들고, 버전에 따른 명령어를 작성하는 방식. 위 링크에서 제공하는 명령은 사이트명이 기입되어있지 않아 조정이 필요하다. * 예시 : php maintenan...
 
 
(같은 사용자의 중간 판 3개는 보이지 않습니다)
2번째 줄: 2번째 줄:
구글 콘솔 서치나 네이버 서치어드바이저 등에 사이트를 등록해야 검색엔진에 노출된다.
구글 콘솔 서치나 네이버 서치어드바이저 등에 사이트를 등록해야 검색엔진에 노출된다.


== 사이트맵 ==
= 구글 =


== 구글 서치콘솔. ==
=== 사이트맵 등록. ===
* 기본적으로 https://www.mediawiki.org/wiki/Manual:GenerateSitemap.php<nowiki/>를 참고.
* 기본적으로 https://www.mediawiki.org/wiki/Manual:GenerateSitemap.php<nowiki/>를 참고.
* 일반적으로 sitemap 디렉토리를 만들고, 버전에 따른 명령어를 작성하는 방식. 위 링크에서 제공하는 명령은 사이트명이 기입되어있지 않아 조정이 필요하다.
* [https://search.google.com/search-console/sitemaps?resource_id=sc-domain%3Asmwiki.info&hl=ko https://search.google.com/search-console/sitemaps?resource_id=s]<nowiki/>[https://search.google.com/search-console/sitemaps?resource_id=sc-domain%3Asmwiki.info&hl=ko c-domain%3Asmwiki.info&hl=ko] 에 url을 올린다.
* 예시 : php maintenance/run.php generateSitemap --memory-limit=50M --fspath=/var/www/html/sitemap/ --identifier=smwiki.info --urlpath=/sitemap/ --server=<nowiki>https://smwiki.info</nowiki> --compress=yes --skip-redirects
* 가끔 갱신해주어야 함.(아래, 사이트맵 생성 명령어로 갱신)
* 명령이 제대로 기입되면 https://smwiki.info/sitemap/sitemap-index-smwiki.info.xml 가 사이트맵 주소가 된다.
{| class="wikitable"
!과정
!설명
!비고
|-
|디렉토리 제작
|
* sudo mkdir -p /var/www/html/sitemap
* sudo chown -R www-data:www-data /var/www/html/sitemap
* sudo chmod -R 775 /var/www/html/sitemap
|
|-
|사이트맵 생성
|php maintenance/run.php generateSitemap \
  --memory-limit=50M \
 
  --fspath=/var/www/html/sitemap/ \
 
  --identifier=smwiki.info \
 
  --urlpath=/sitemap/ \
 
  --server=<nowiki>https://smwiki.info</nowiki> \
 
  --compress=yes \
 
  --skip-redirects
|
* mediawiki 디렉토리에서 실행.
* 이렇게 하면 html/sitemap 디렉토리에 sitemap-index-smwiki.info.xml 형식으로 파일이 생성된다.
|-
|사이트맵 권한 설정
|이상하게 계정에 귀속된 파일들이 생성된다. 권한 다시 설정.
 
* sudo chown -R www-data:www-data /var/www/html/sitemap
* sudo chmod -R 775 /var/www/html/sitemap
|
|-
|nginx 설정
|<syntaxhighlight lang="bash">
    # sitemap.xml 파일 제공(bot의 크롤링을 위해.)
    location /sitemap/ {
        root /var/www/html;
        autoindex on;
        allow all;
        log_not_found off;
        access_log off;
    }
</syntaxhighlight>
|
* root /var/www/html/mediawiki; 라면 미디어위키 설치파일 안에 둔다.
* 웹서버 설정에서 주소의 깔끔함을 위해 / 경로를 index로 해두는 경우가 있는데, 이땐 robots.txt 설정을 따로 해주어야 한다.([[위키 백업과 복구#nginx 설정]] 참고.)
|}
명령이 제대로 기입되면 "<nowiki>https://smwiki.info/sitemap/sitemap-index-smwiki.info.xml</nowiki>"가 사이트맵 주소가 된다.
 
=== robots.txt 등록 ===
구글 봇이 크롤링을 할 수 있게 설정.
 
https://search.google.com/search-console/settings/robots-txt?resource_id=sc-domain%3Asmwiki.info&hl=ko
{| class="wikitable"
!과정
!설명
!비고
|-
|웹서버 설정
|루트 디렉토리에 robots.txt를 작성한다.
|
* 웹서버 설정에서 주소의 깔끔함을 위해 / 경로를 index로 해두는 경우가 있는데, 이땐 robots.txt 설정을 따로 해주어야 한다.([[위키 백업과 복구#nginx 설정]] 참고.)
|-
|robots.txt 작성
|<syntaxhighlight lang="bash">
User-agent: *
# 불필요한 스크립트 파일 직접 접근 차단
Disallow: /index.php
Disallow: /load.php
Disallow: /api.php
Disallow: /rest.php
# 특수 문서 등 검색 불필요 페이지 차단
Disallow: /wiki/Special:
# 민감한 폴더 접근 차단 (Nginx 설정에서도 막았지만 robots.txt에서도 알려주는 게 좋음)
Disallow: /cache/
Disallow: /includes/
Disallow: /languages/
Disallow: /maintenance/
Disallow: /serialized/
Disallow: /store/
Disallow: /vendor/
# 이미지 폴더 자체 접근(목록) 차단 (images 폴더 안의 개별 이미지는 당연히 허용됨)
Disallow: /images/
 
# 미디어위키 리소스, 확장 기능, 스킨 등 필요한 파일 접근 허용 (Disallow보다 Allow 우선)
# Allow: 는 Disallow 규칙에 의해 막혔더라도 이 경로는 허용하겠다는 의미
# 루트(smwiki.info/)에서 바로 시작하는 경로로 수정
Allow: /resources/
Allow: /extensions/
Allow: /skins/
 
# 사이트맵 위치
Sitemap: https://smwiki.info/sitemap/sitemap-index-smwiki.info.xml


</syntaxhighlight>
|
* sitemap.xml은 설정하기 나름이니... 참고참고.
* 웹서버 설정에서 미디어위키 서버를 루트로 잡고, index를 거치게 들어오게 해도 적절히 설정했다면 이처럼 접속해도 문제 없다.(try_files $uri $uri/ @rewrite; 따위로, 실제 파일이 있으면 그 파일을 반환해주고, 없으면 index를 거치게 되어 있다.)
|}
[[분류:관리용 문서]]
[[분류:관리용 문서]]

2025년 5월 5일 (월) 13:19 기준 최신판

구글 콘솔 서치나 네이버 서치어드바이저 등에 사이트를 등록해야 검색엔진에 노출된다.

구글 서치콘솔.

[편집 | 원본 편집]

사이트맵 등록.

[편집 | 원본 편집]
과정 설명 비고
디렉토리 제작
  • sudo mkdir -p /var/www/html/sitemap
  • sudo chown -R www-data:www-data /var/www/html/sitemap
  • sudo chmod -R 775 /var/www/html/sitemap
사이트맵 생성 php maintenance/run.php generateSitemap \

  --memory-limit=50M \

  --fspath=/var/www/html/sitemap/ \

  --identifier=smwiki.info \

  --urlpath=/sitemap/ \

  --server=https://smwiki.info \

  --compress=yes \

  --skip-redirects

  • mediawiki 디렉토리에서 실행.
  • 이렇게 하면 html/sitemap 디렉토리에 sitemap-index-smwiki.info.xml 형식으로 파일이 생성된다.
사이트맵 권한 설정 이상하게 계정에 귀속된 파일들이 생성된다. 권한 다시 설정.
  • sudo chown -R www-data:www-data /var/www/html/sitemap
  • sudo chmod -R 775 /var/www/html/sitemap
nginx 설정
    # sitemap.xml 파일 제공(bot의 크롤링을 위해.)
    location /sitemap/ {
        root /var/www/html;
        autoindex on;
        allow all;
        log_not_found off;
        access_log off;
    }
  • root /var/www/html/mediawiki; 라면 미디어위키 설치파일 안에 둔다.
  • 웹서버 설정에서 주소의 깔끔함을 위해 / 경로를 index로 해두는 경우가 있는데, 이땐 robots.txt 설정을 따로 해주어야 한다.(위키 백업과 복구#nginx 설정 참고.)

명령이 제대로 기입되면 "https://smwiki.info/sitemap/sitemap-index-smwiki.info.xml"가 사이트맵 주소가 된다.

robots.txt 등록

[편집 | 원본 편집]

구글 봇이 크롤링을 할 수 있게 설정.

https://search.google.com/search-console/settings/robots-txt?resource_id=sc-domain%3Asmwiki.info&hl=ko

과정 설명 비고
웹서버 설정 루트 디렉토리에 robots.txt를 작성한다.
  • 웹서버 설정에서 주소의 깔끔함을 위해 / 경로를 index로 해두는 경우가 있는데, 이땐 robots.txt 설정을 따로 해주어야 한다.(위키 백업과 복구#nginx 설정 참고.)
robots.txt 작성
User-agent: *
# 불필요한 스크립트 파일 직접 접근 차단
Disallow: /index.php
Disallow: /load.php
Disallow: /api.php
Disallow: /rest.php
# 특수 문서 등 검색 불필요 페이지 차단
Disallow: /wiki/Special:
# 민감한 폴더 접근 차단 (Nginx 설정에서도 막았지만 robots.txt에서도 알려주는 게 좋음)
Disallow: /cache/
Disallow: /includes/
Disallow: /languages/
Disallow: /maintenance/
Disallow: /serialized/
Disallow: /store/
Disallow: /vendor/
# 이미지 폴더 자체 접근(목록) 차단 (images 폴더 안의 개별 이미지는 당연히 허용됨)
Disallow: /images/

# 미디어위키 리소스, 확장 기능, 스킨 등 필요한 파일 접근 허용 (Disallow보다 Allow 우선)
# Allow: 는 Disallow 규칙에 의해 막혔더라도 이 경로는 허용하겠다는 의미
# 루트(smwiki.info/)에서 바로 시작하는 경로로 수정
Allow: /resources/
Allow: /extensions/
Allow: /skins/

# 사이트맵 위치
Sitemap: https://smwiki.info/sitemap/sitemap-index-smwiki.info.xml
  • sitemap.xml은 설정하기 나름이니... 참고참고.
  • 웹서버 설정에서 미디어위키 서버를 루트로 잡고, index를 거치게 들어오게 해도 적절히 설정했다면 이처럼 접속해도 문제 없다.(try_files $uri $uri/ @rewrite; 따위로, 실제 파일이 있으면 그 파일을 반환해주고, 없으면 index를 거치게 되어 있다.)