original source : https://youtu.be/C-bUHSXCEEs

2021 11월 대부분 apache 2.4 를 사용한다. 

/var/www/html에 웹문서를 놓게 된다.

red hat 계열 리눅스의 경우 /etc/httpd/ 에 apache서버 화일이 있다.

/var는 사용자가 만든 화일

/etc는 모든 어플리케이션의 설정화일을 가지고 있다. 

리눅스는 크게

     – redhat계열 2021년 11월 버전 8.5

     – ubuntu계열  2021년 11월 버전 20.2 (매 2년 마다 나오며 앞수는 년도 뒷수는 월)

웹서버는 크게

      – apache (httpd)

      – nginx 

image
image

설정 문서들어가기 

서버 root 경로 지정

기본적으로 web server는 80 포트를 사용하는데 다르게 설정도 가능

설정문서를 여러개로 나누어 관리하는게 일반적

root 계정으로 웹서버를 사용하는데는 보안상 문제가 생길수 있으므로 apache는 복제 process를 이용하는데 이때 사용되는 계정 

관리자 설장

/ 폴더 설정

외부에 제공되는 document root

/var/www 폴더 설정

<IfModule dir_module> 은 만약 dir_module이 설치 되었으면 안애 설정을 수행한다는 의미 DirectoryIndex는 그 폴더의 기본 문서 설정

error log 출력 경로

1. godaddy에 mysql wizard를 통해 데이터베이스, 사용자를 만든다.

2. domain을 설정하고 이에 연결되는 directory를 public_html에 생성한다. (ex. conotics.18th-century-programmer.com)

3. project를 넣을 폴더를 만든다. (ex. python_projs/conotics)

4. python project를 cpanel에서 만든다. 프로젝트 화일이 들어갈 폴더 만들고 log들어갈 폴더 만든다. python은 3.4로 해봤는데 아래와 같이 에러 발생 최소 3.5는 되어야한다.

.

ERROR: This lxml version requires Python 2.7, 3.5 or later.

.

5. 내 localhost에 개발한 프로젝트를 filezilla 통해 업로드한다.

6. 터미널에서 프로젝트폴더로 이동하고 cpanel python 프로젝트에 나온 virtualenv activate하는 명령구문 복사해서 실행한다. 

7. pip install –upgrade pip 을 통해 pip을 업그레이드 한다.

8. https://github.com/ASKBOT/askbot-devel/blob/master/askbot_requirements.txt 에서 복사해서 askbot requirements.txt를 만들어준다.

9. 터미널에서 pip install -r requirements.txt 를 통해 requirement.txt에 있는 디펜던시를 설치한다.

.

.

.

.

====================================

1. python project를 만든다. 3.6.11

   - 이때 두개의 폴더가 자동으로 만들어 진다. 예를 들어 python_projs/conotics이라고 입력한 경우. python_projs/conotics와 virtualenv/python_projs/conotics이게 만들어진다. 실제 pip 명령어로 설치되는 module들은 virtualenv/python_projs/conotics에 설치된다.

2. pip install “askbot==0.11.0″

3. 프로젝트를 설치할 폴더로 이동(나의 경우 virtualenv/python_projs/conotics를 사용) askbot-setup 실행한다. 

4. 질문에 따라 입력하면 askbot_site 폴더가 만들어진다. (기본값 사용경우)

5. settings.py에 들어가서 host, media root , static root수정

6. python manage.py collectstatic 실행

7. Did you install mysqlclient? 에러 발생

8. pip install mysqlclient

9. python manage.py collectstatic 실행 

10. python manage.py makemigrations 

11. python manage.py migrate

macbook에 설치해본 과정

https://www.howtoforge.com/tutorial/how-to-install-and-configure-askbot-on-ubuntu-1604/

기본적으로 과정은 위내용을 기반으로 한다.

– mysql을 준비한다. database를 만들어준다. 데이터베이스 사용자(ex. root)를 준비한다. 이미 있었다면 그것을 사용해도 된다.

– mysql을 이용하는데 편의를 위해서는 나는 phpmyadmin을 이용했다. 이를 위해서는 apache server를 켜주어야 한다. 터미널에 명령어 sudo apachectl start를 입력한다.

localhost를 들어가보면 작동하는 것을 확일할수 있다. 

finder에서 go computer 를 통해서 /Library/WebServer/Documents/phpmyadmin 경로로 들어가면 그곳에 phpmyadmin이 설치 되었는 알수 있고 localhost/phpmyadmin을 입력하면 phpmyadmin들어 갈수 있다.

https://youtu.be/vHYh-m4iXw4

– 작업하고 싶은 폴더로 이동하고 virtualenv로 가상 작업 공간을 만든다.

– source bin/activate 명령어를 통해 가상 작업공간으로 들어간다

– pip install “askbot==0.11.1″ 을 통해 askbot을 설치한다. (복사해서 붙여서 “Invalid requirement” 에러 발생하면 타이핑하기)

아래내용과 같이 django 2.2, python 3이상을 지원하는 것은 0.11.x 뿐이어서 이렇게 명확하게 해주어야 한다. 

https://github.com/ASKBOT/askbot-devel/tree/0.11.x 

Branch 0.7.x – is the latest version supporting Django 1.5

Branch 0.8.x – transitional version for the upgrade of the database to Django 1.7

Branch 0.9.x supports Django 1.7

Branch 0.10.x – supports Django 1.8 – the last version series to support Python 2.7

Branch master – released as versions 0.11.x – supports Django 2.2/Python 3

– 설치후에 askbot-setup 를 통해 설치한다. directory, database, email 등등 물어 보는 대로 입력한다.

– python manage.py collectstatic 명령을 통해 static files을 복사하게 한다.

– python manage.py makeimgrations

– python manage.py migrate 를 통해 데이터베이스 작업을 한다.

https://stackoverflow.com/a/28444650/3151712

NameError: name ’_mysql’ is not defined after setting change to mysql 이런 에러메시지가 나오면 

export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$PATH"

https://stackoverflow.com/a/65869751/3151712 처럼 해결한다.

서버를 껐다가 다시 키면 위 명령어 다시 시작해야 한다.

.

.

tips) 

– virtualenv는 프로젝트 폴더내 conotics 폴더안의 bin 안의 activate를 통해 활성화 한다.

https://this-programmer.tistory.com/345

gunicorn은 대체 뭐하는 놈일까 (부제: CGI, WSGI는 대체 뭐냐)

django를 배포하려고 하면 꼭 gunicorn이나 uWSGI라는 놈과 마주친다. 튜토리얼 보스마냥 이 둘을 마주치지 않고 배포를 할 수는 없는 모냥이다. 왜 php는 Apache나 nginx처럼 웹서버만 있으면 되는데 django는 WSGI라 불리는 아이들을 거쳐야 하는 걸까? 한번 알아보자.

gunicorn은 WSGI의 일종이다. 그렇다면 WSGI는 뭘까? CGI의 일종이다. 그렇다면 CGI는 뭘까? 그렇다. gucniron이 뭐하는 놈인지 이해하기 위해선 CGI라는 것부터 이해해야 한다.
CGI를 풀어써보면 Common Gateway Interface라고 하는데 한국말로 직역하자면 “공용 경로 인터페이스"라고도 할 수 있다. 영어로 된 단어를 억지로 직역하려니 느낌이 이상한데 이는 웹의 역사와 함께 이해하면 쉬울 것이다.
웹은 원래 정적인 정보의 나열이 전부였다. 워낙에 웹이 발전하다보니 오히려 정적인 웹을 찾기 힘든 추세가 되어 잘 와닿지 않을 수 있는데 회원가입이나 Contact Form도 따로 없는, 그저 할 수 있는게 볼 수 있는 것밖에 없는 회사소개 페이지를 떠올리면 될 것이다. 그렇게 단순 정보의 나열뿐이었던 단방향 형태의 웹은 점점 수요가 다양해지고 당연스럽게 동적인 웹으로서의 발돋음을 하게 되는데 그 과정에서 사용자들이 입력하는 데이터를 처리할 로직이 필요했다. 예를 들어 내가 회원가입을 하면 회원 리스트에 내 이름이 올라가는 것처럼 말이다.
이것을 처리하기 위해 개발자들은 각자 자신이 사용하던 언어를 사용하기 시작했는데 언어가 제각각이니 규격도 제각각 아니겠는가. 하지만 이를 "공통적인 형태"로 주고받기 위해 만든 것이 바로 CGI이다. 그러니까 이런저런 언어들이 사용자들의 다양한 요청을 이해할 수 있게 "이 문을 지나면 이러한 형태가 됩니다"하고 정해놓은 규약이자 프로그램이 바로 CGI라는 것이다.
위의 예제로 설명하자면 회원가입한 자신의 목록을 다시 조회하기 위해선 html만으로는 어림없다. 서버 내부에서 데이터를 저장하고 조회하는 일련의 기능이 있어야 하는데 이러한 사용자의 http request가 webserver를 통해 서버 내부로 들어오고 CGI를 통해 일관된 형태로 해석되어 응용 프로그램에 전달돼 사전 작성해놓은 로직에 따라 html을 다시 그래내어 webserver의 http response를 통해 사용자에게 되돌아가는 것이다. 그러니까 결론적으로 말하자면 CGI는 웹서버와 응용프로그램 사이의 동시통역사라고 할 수 있다.

그렇다면 WSGI는 무엇일까? WSGI는 풀어 쓰면 Web Server Gateway Interface이다. 딱 봐도 "웹을 위해 만들어진 인터페이스구나” 라는 걸 알 수 있는데 틀린 말은 아니지만 애석하게도 파이썬 스크립트가 웹 서버와 통신하기 위해 만들어진 인터페이스이다. 파이썬이라는 단어는 없지만 파이썬을 위해 만들어진 것이라는 의미이다. 위에서 CGI를 설명한 것과 같이 웹서버에서의 요청을 해석하여 파이썬 응용프로그램에 던지는 역할을 한다.

그러니까 Gunicorn이나 uWSGI는 Apache나 nginx로 들어오는 HttpRequest를 Python이 이해할 수 있게 동시통역하여 던져주는 애들이라고 할 수 있는 것이다. 글을 들어가면서 말했던, 이러한 미들웨어가 필요없어보이는 php도 apache서버를 설정할 때 주석 해제를 통해 php버전에 맞게 모듈을 활성화시키는 걸 알고 있을 것이다. 그것이 바로 CGI역할을 하는 것이다. 스프링을 배포할 때에는 톰캣이 이러한 역할을 맡는다고 보면 쉽게 이해가 될 것이다. 그리고 이렇게 해석기와 웹서버가 달려있는 애들을 흔히 WAS(Wep Application Server)라고 부른다.

각주

표현하기 쉽게 하기 위해 WSGI가 CGI의 일종이라고 하였지만 사실 WSGI는 CGI에서 파생된 개념이고 CGI는 CGI그 자체가 독창적인 실행방식으로 존재하고 있는 프로그램의 일종(예: 요청마다 프로세스를 생성하여 던져주는 방식 등)이기 때문에 WSGI는 CGI의 일종이라고 표현하는 데에는 약간 어폐가 있다. 하지만 이해하기 쉽게 하기 위해 이렇게 표현하였음을 알리는 바이다. 컵라면은 라면의 파생품이지만 각자가 각자의 방식대로 존재하는 것처럼 이해하면 쉬울 것이다.

기존 heroku에 있던 미니 사이트를 godaddy로 옮기는 과정에서 공부한 내용

How to run Django on cpanel || django cpanel || how to || tutorialhttps://youtu.be/EZSvsgemDJ0

.

.

GoDaddy | How To Connect To Your GoDaddy Shared Hosting with SSH | [SOLVED] SSH Access Not Enabled

https://youtu.be/diccGcppnLg

.

.

How to install PuTTY/PuTTYgen on Mac OS | How to use PuTTY SSH keys with the built-in OpenSSH

https://youtu.be/w4UqdL9emRw

.

.

cPanel Hosting & Filezilla FTP Connect, Upload, And Transfer Files GoDaddy

https://youtu.be/fcIWfajTZg0

https://meta.stackexchange.com/a/37953

Stack Exchange has released an updated, feature-complete version of the Stack Overflow engine which is now available for enterprise use. You can read more about that here

The Stack Exchange engine is available for use

(Note that this is different from Stack Overflow for Teams, which is a hosted solution.)

But if that does not meet your needs, there are several third-party tools that try to clone at least some of the functionality here.

Most active that look like the best bets

Open source

Not open source

  • AllAnswered: Django. Include Q&A in its knowledge management system. Not Free.
  • AnswerHub: Java. Live site. Enterprise Q&A by the people who created OSQA. Not free.
  • Confluence Questions: Java. Enterprise Q&A developed and supported by Atlassian. Not free.
  • Haydle: SaaS, free 30 day trial. Haydle is focused on being a private, internal Q&A system.
  • Q&A: Live Site. WordPress Plugin. Actively developed by a company that looks reliable. No longer free; $19 to download (with no membership)
  • Quandora
  • Rootbuzz: Django, hosting, actively developed, non-free
  • SabaiDiscuss: commercial WordPress Plugin
  • Tribe: SaaS, freemium plan. Tribe allows you to build your own social app (including internal or external Q&A sites).
  • Programlama: Python, flask (In Turkish)
  • Unity Answers: Allowed topics are the Unity editor and C# (the site is free and in English)

Ones that look sort of finished

  • shapado: Ruby, mongomapper and MongoDB. AGPLv3. Website unreachable, Last commit in 2012.
  • OSQA: Django. GPLv3. Last commit in 2015. AnswerHub has replaced OSQA as DZone’s primary Q&A solution.
  • openoverflow: Ruby, PostgreSQL, Haml. MIT license. No example site, and I can’t find anyone using this one. Not a lot of recent activity; last code commit, May 2009.
  • phpancake: PHP, Zend framework, MySQL. Live site. MIT license. Last activity Jan 2013. Renders very poorly in some browsers; the live site states “I am aware of this site not working properly. I am working on it!”.
  • cahoots: PHP, MySQL. GPL, MIT license. Officially inactive; demo site offline; last update Aug 2010.
  • Coordino: PHP, MySQL. MIT license. feature tour; last commit in 2015.
  • Qwench: PHP. Example site (currently offline). Almost no activity since 2009.
  • soclone: Django framework. MIT license. Seems to have gone stale in Nov 2008 (and only started on Google Code at the end of Oct 2008).
  • Solace: Inactive; last commit in 2010.
  • PaizaQA: Demo, MEAN (MongoDB, Express, AngularJS, and Node.js), Not active, MIT license
  • Kliqqi: PHP, MySQL. Different look, hosting available. Not active, CC-BY 3.0 license
  • stacked: ASP.NET, Ra-Ajax, ActiveRecord ORM. GPLv3.
  • Arrayshift Drupal plugin GPLv2, last commit in 2016.
  • Kunjika: Python, Flask, and Couchbase. GNU GPLv3 or later. Website (not reachable anymore as of October 2019).

Others that seem to be work in progress

  • Asking: Perl, Mojolicious. Perl License (Artistic). Little documentation at this point. GitHub repository README.md in Portuguese.
  • FortyTwo: Python, Django, CouchDB. Example site link leads to a 404. Unknown license. Little information. [Last commit in January 2011]
  • kerjakelompok: No example site. Unknown license. Little info.
  • SmartR: No example site. MIT License. Little info.
  • Stack Underflow: C#. No example site. License is “do whatever you want with it” (I haven’t defined a formal license yet). Written as a learning project.
  • T002_rails-overflow: Ruby on Rails. No example site. Unknown license. Little info. Apache license.
  • CNPROG: Python/Django. Project officially closed. Was used as base by OSQA & Askbot.
  • QARoR – open source questions & answers platform for Ruby on Rails. Here is the demo and source on GitHub. Released under MIT License.
  • Veaos: MERN (MongoDB, Express, React and Node.js)

Sorted by language

PHP

Perl

Python

Ruby

Java

Scala

ASP.NET

MEAN/MERN (MongoDB, Express, Angular/React, and Node.js)