사이트 등록: 두 판 사이의 차이
보이기
잔글 →개요 |
|||
| 6번째 줄: | 6번째 줄: | ||
== 구글 서치콘솔. == | == 구글 서치콘솔. == | ||
=== robots.txt 등록. == | === robots.txt 등록 === | ||
구글 봇이 크롤링을 할 수 있게 설정. | |||
https://search.google.com/search-console/settings/robots-txt?resource_id=sc-domain%3Asmwiki.info&hl=ko | |||
{| class="wikitable" | {| class="wikitable" | ||
!과정 | !과정 | ||
| 15번째 줄: | 18번째 줄: | ||
|루트 디렉토리에 robots.txt를 작성한다. | |루트 디렉토리에 robots.txt를 작성한다. | ||
| | | | ||
* 웹서버 설정에서 주소의 깔끔함을 위해 / 경로를 index로 해두는 경우가 있는데, 이땐 robots.txt 설정을 따로 해주어야 한다.([[위키 백업과 복구#nginx 설정]] 참고.) | * 웹서버 설정에서 주소의 깔끔함을 위해 / 경로를 index로 해두는 경우가 있는데, 이땐 robots.txt 설정을 따로 해주어야 한다.([[위키 백업과 복구#nginx 설정]] 참고.) | ||
|- | |- | ||
|robots.txt 작성 | |robots.txt 작성 | ||
|User-agent: * | |||
Disallow: /index.php | |||
Disallow: /load.php | |||
Disallow: /api.php | |||
Disallow: /rest.php | |||
Disallow: /mediawiki/ | |||
Disallow: /wiki/Special: | |||
Allow: /mediawiki/resources/ | |||
Allow: /mediawiki/extensions/ | |||
Allow: /mediawiki/skins/ | |||
Sitemap: <nowiki>https://smwiki.info/sitemap.xml</nowiki> | |||
|sitemap.xml은 설정하기 나름이니... 참고참고. | |||
|} | |||
=== 사이트맵 === | |||
* 기본적으로 https://www.mediawiki.org/wiki/Manual:GenerateSitemap.php<nowiki/>를 참고. | |||
* 일반적으로 sitemap 디렉토리를 만들고, 버전에 따른 명령어를 작성하는 방식. 위 링크에서 제공하는 명령은 사이트명이 기입되어있지 않아 조정이 필요하다. | |||
{| 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.xml { | |||
alias /var/www/html/sitemap/sitemap-index-smwiki.info.xml; | |||
allow all; | |||
log_not_found off; | |||
access_log off; | |||
} | |||
</syntaxhighlight> | |||
| | |||
* root /var/www/html/mediawiki; 라면 미디어위키 설치파일 안에 둔다. | |||
* 웹서버 설정에서 주소의 깔끔함을 위해 / 경로를 index로 해두는 경우가 있는데, 이땐 robots.txt 설정을 따로 해주어야 한다.([[위키 백업과 복구#nginx 설정]] 참고.) | |||
|} | |||
명령이 제대로 기입되면 "<nowiki>https://smwiki.info/sitemap.xml</nowiki>"가 사이트맵 주소가 된다. | |||
[[분류:관리용 문서]] | [[분류:관리용 문서]] | ||
2025년 5월 5일 (월) 12:24 판
개요
구글 콘솔 서치나 네이버 서치어드바이저 등에 사이트를 등록해야 검색엔진에 노출된다.
구글
구글 서치콘솔.
robots.txt 등록
구글 봇이 크롤링을 할 수 있게 설정.
| 과정 | 설명 | 비고 |
|---|---|---|
| 웹서버 설정 | 루트 디렉토리에 robots.txt를 작성한다. |
|
| robots.txt 작성 | User-agent: *
Disallow: /index.php Disallow: /load.php Disallow: /api.php Disallow: /rest.php Disallow: /mediawiki/ Disallow: /wiki/Special: Allow: /mediawiki/resources/ Allow: /mediawiki/extensions/ Allow: /mediawiki/skins/ Sitemap: https://smwiki.info/sitemap.xml |
sitemap.xml은 설정하기 나름이니... 참고참고. |
사이트맵
- 기본적으로 https://www.mediawiki.org/wiki/Manual:GenerateSitemap.php를 참고.
- 일반적으로 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 |
|
| 사이트맵 권한 설정 | 이상하게 계정에 귀속된 파일들이 생성된다. 권한 다시 설정.
|
|
| nginx 설정 | # sitemap.xml 파일 제공(bot의 크롤링을 위해.)
location = /sitemap.xml {
alias /var/www/html/sitemap/sitemap-index-smwiki.info.xml;
allow all;
log_not_found off;
access_log off;
}
|
|
명령이 제대로 기입되면 "https://smwiki.info/sitemap.xml"가 사이트맵 주소가 된다.