XAMPP - pengaturan server virtual


Unduh XAMPP

XAMPP ver. 1.8.3-3 untuk Mac OS X ver. 10.9.2


Pengaturan awal


XAMPP awalnya memiliki satu alamat, localhost
Saat memuat - halaman harus terbuka dengan informasi tentang server, versi PHP dengan tautan ke phpmyadmin, dll.

Untuk membuat host Anda VirtualHost Apache

1. Buka file konfigurasi - /Applications/XAMPP/xamppfiles/etc/httpd.conf

1.1. Ubah daemon Pengguna menjadi Nama pengguna pengguna (p. 173)

171 #running httpd, as with most system services. 172 # 173 User daemon 174 Group daemon 175 </IfModule> 

di mana nama pengguna adalah nama pengguna Anda di Mac OS X

 171 #running httpd, as with most system services. 172 # 173 User username 174 Group daemon 175 </IfModule> 

1.2. Nyalakan VirtualHosts - tidak memberi komentar (hal. 488)

  • Sertakan etc / extra / httpd-vhosts.conf

 487 #Virtual hosts 488 #Include etc/extra/httpd-vhosts.conf 

hapus kisi sebelum Sertakan

 487 #Virtual hosts 488 Include etc/extra/httpd-vhosts.conf 


2. Menambahkan host Anda - buka file - /Applications/XAMPP/etc/extra/httpd-vhosts.conf

2.1. Agar host lokal berfungsi tidak berubah

 #localhost <VirtualHost *:80> ServerName localhost DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" <Directory "/Applications/XAMPP/xamppfiles/htdocs"> Options Indexes FollowSymLinks Includes execCGI AllowOverride All Allow From All Order Allow,Deny </Directory> </VirtualHost> 

2.2. Hubungkan situs Anda - buat folder situs site.local (contoh)
nama pengguna adalah nama pengguna Mac OS X Anda
folder - biarkan ke folder situs
site.local - folder situs

 #My custom host <VirtualHost *:80> ServerName site.local DocumentRoot "/Users/username/folder/site.local" <Directory "/Users/username/folder/site.local"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Directory> ErrorLog "logs/site.local-error_log" </VirtualHost> 

Arahan AllowOverride None harus diganti dengan AllowOverride All, jika file .htaccess tidak akan dibaca oleh server Apache

3. Anda harus memberi tahu Mac OS X di mana situs-situs virtual itu berada.
Di terminal, masukkan perintah:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit / etc / hosts

Tambahkan baris di akhir file hosts: 127.0.0.1 site.local

 #XAMPP VirtualHost 127.0.0.1 site.local 

Kami memulai ulang XAMPP dan host virtual ditambahkan.

oleh localhost - membuka XAMPP
by site.local - situs kami sudah terbuka.

Selesai!

Source: https://habr.com/ru/post/id439994/


All Articles