Windows पर Apache
In this page:
Windows अलग क्यों है
apache.org से कोई official Apache binary Windows के लिए उस simple sense में नहीं है जैसे एक Linux package है -- Apache officially prebuilt Windows binaries बिल्कुल भी distribute नहीं करता। इसकी जगह, ज़्यादातर लोग या तो एक third-party build इस्तेमाल करते हैं (Apache Lounge एक जाना-पहचाना है) या, कहीं ज़्यादा आम तौर पर, XAMPP या WAMP जैसा एक bundled stack install करते हैं, जो Apache, MySQL, और PHP को एक आसान installer के साथ पैक करता है।
XAMPP से Install करना
XAMPP local development के लिए Windows पर Apache चलाने का सबसे आम तरीका है: apachefriends.org से installer download करें, इसे run करें, और यह C:\xampp\ जैसे एक folder के नीचे Apache, MySQL/MariaDB, PHP, और phpMyAdmin साथ में install कर देता है। XAMPP Control Panel आपको एक button से Apache start और stop करने देता है, जो Linux पर इस्तेमाल होने वाले systemctl commands की जगह लेता है।
Apache को Windows Service की तरह Run करना
(XAMPP की जगह) एक standalone Apache install आमतौर पर एक Windows service की तरह register किया जाता है ताकि यह automatically start हो। Apache के bin folder के अंदर एक elevated command prompt से:
``
httpd.exe -k install
httpd.exe -k start
httpd.exe -k stop
httpd.exe -k restart
``
एक बार service की तरह installed होने के बाद, यह Windows Services app (services.msc) में भी दिखता है, जहाँ आप इसे किसी भी दूसरी Windows service की तरह start, stop, और boot पर launch होने के लिए set कर सकते हैं।
Windows पर Config File Locations
एक XAMPP install पर, main config file C:\xampp\apache\conf\httpd.conf पर है, और virtual hosts आमतौर पर C:\xampp\apache\conf\extra\httpd-vhosts.conf में होते हैं। एक standalone Apache Lounge-style install आपने जहाँ भी extract किया हो वहाँ same conf\httpd.conf layout रखता है। configuration *syntax* Linux जैसा ही identical है -- सिर्फ file paths (backslashes इस्तेमाल करना, और आमतौर पर एक C:\ drive) अलग होते हैं।
DocumentRoot "C:/xampp/htdocs"), भले ही Windows सामान्यतः backslashes इस्तेमाल करता हो।आम Windows Port Conflicts
Windows पर port 80 अक्सर पहले से ही Internet Information Services (IIS), Skype, या "World Wide Web Publishing Service" द्वारा इस्तेमाल में होता है। अगर Apache port के इस्तेमाल में होने की error के साथ start होने में fail हो, तो या तो conflicting service रोकें या local development के लिए Apache की Listen directive को 8080 जैसे किसी दूसरे port पर बदल दें।
उदाहरण: Managing Apache as a Windows service
REM Run from an elevated Command Prompt inside Apache's bin\ folder
httpd.exe -k install
httpd.exe -k start
httpd.exe -k stop
httpd.exe -k restart
{# Flagged by hand after confirming a runner can't handle this example
(a shell command / go.mod file stored as a TopicExample, a language
feature the configured runner version doesn't support, or output
that blows a runner's sandbox limit) -- see TopicExample.norun.
Never render the run button for these, regardless of language,
since it would just fail at execute_code (or worse, hang the
Judge0 queue on a submission that can never finish cleanly). #}
- एक official apache.org Windows installer की उम्मीद करना जैसे official Linux package होता है -- ज़्यादातर लोगों को Windows पर Apache XAMPP/WAMP या Apache Lounge जैसे third-party build से मिलता है।
- यह notice न करना कि IIS या Skype ने पहले से port 80 खोला हुआ है, फिर एक खराब Apache config मान लेना जबकि असली error "port already in use" है।
httpd.confdirectives के अंदर Windows-style backslash paths (C:\xampp\htdocs) इस्तेमाल करना, जबकि Apache का config syntax Windows पर भी forward slashes की उम्मीद करता है।
- Apache वह web server software है जो internet और आपकी website की files के बीच बैठकर requests, routing, और responses handle करता है; यह operating systems में अलग-अलग तरीके से install और run होता है लेकिन हर जगह same directive syntax से configure होता है।
- Ubuntu/Debian पर, Apache
apache2package है जिसेsystemctlऔरa2ensite/a2enmodसे manage किया जाता है; RHEL-family Linux पर यहhttpdहै; Windows पर यह सबसे आम तौर पर XAMPP से install होता है याhttpd.exe -kके साथ Windows service की तरह run होता है।
Chapter Quiz — Complete all 4 topics to unlock
0/4 topics done
Complete these topics first: