← Back to Apache Course | Chapter 1: Introduction & Setup | Lesson 2 of 4

Apache Install करना

Apache को configure या इस्तेमाल करने से पहले, इसे किसी machine पर install करना होता है। यह कैसे किया जाता है यह operating system पर depend करता है, लेकिन process का आकार -- package install करो, service start करो, check करो कि चल रहा है -- हर जगह same है।

Apache कहाँ चलता है

Apache local development के लिए आपके अपने laptop पर, cloud server (AWS, DigitalOcean वगैरह पर एक Linux VM) पर, या किसी company के अपने server room में on-premise hardware पर चल सकता है। ज़्यादातर production Apache installs Linux पर होते हैं, क्योंकि वहाँ install करना सबसे तेज़ है, automate करना सबसे आसान है, और ज़्यादातर hosting documentation वहीं काम करने की उम्मीद रखती है।

चेक करना कि यह पहले से है या नहीं

कई Linux distributions और कुछ hosting images में Apache pre-installed आता है, या हो सकता है यह किसी पिछले admin ने install किया हो। कुछ भी install करने से पहले, यह check करने के लिए apache2 -v (Debian/Ubuntu) या httpd -v (RHEL/CentOS/Fedora) चलाएं कि यह पहले से है या नहीं और कौन सा version है।

सामान्य Install Flow

लगभग हर platform पर, Apache install करना same तीन steps follow करता है: system के package manager से package install करो, Apache service start करो (और boot पर start होने के लिए enable करो), फिर Apache का default "It works!" page देखने के लिए server के IP address को browser में visit करो। exact commands OS के हिसाब से अलग होते हैं, जिसे अगले दो lessons Linux और Windows के लिए detail में cover करते हैं।

Note: install करने के बाद हमेशा browser या curl localhost से verify करें -- service का "active" report करना इस बात का सबूत नहीं है कि server असल में reachable है और सही configure हुआ है।

Apache की अपनी Naming: httpd बनाम apache2

Apache का binary upstream और RHEL-family distributions (CentOS, Fedora, Rocky Linux, AlmaLinux) पर httpd कहलाता है। Debian-family distributions (Debian, Ubuntu) इसे apache2 नाम से package करते हैं। functionally ये same software हैं -- फर्क सिर्फ इसमें है कि हर distro family पर package, service, और config directory को क्या कहा जाता है।

Warning: RHEL/CentOS box पर apache2 के लिए लिखा tutorial copy-paste करना (या इसका उल्टा Debian/Ubuntu पर) package/service नाम पर fail होगा -- हमेशा commands को अपने असली distro family से match करें।
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. RHEL/CentOS/Fedora system पर apt install apache2 चलाना (या Debian/Ubuntu पर yum install httpd) -- हर distro family पर package का नाम अलग है।
  2. install करने के बाद ports 80/443 के लिए firewall open न करना, फिर यह मान लेना कि Apache टूटा है जबकि असली problem यह है कि server बाहर से unreachable है।
  3. service को boot पर start होने के लिए enable करना भूल जाना, ताकि Apache आज तो काम करे लेकिन अगले server reboot के बाद वापस न आए।
🔒

Chapter Quiz — Complete all 4 topics to unlock

0/4 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.