Apache virtual host without domain name

后端 未结 3 623
青春惊慌失措
青春惊慌失措 2021-02-01 06:43

I have a VPS with apache2 installed and I would like to access some PHP projects without a domain name just with the IP address. For example:

http://162.243.93.2         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-02-01 07:40

    Create a new virtual host file, and setup like this:

    
            ServerAdmin webmaster@localhost
            ServerAlias 192.168.1.1 
            DocumentRoot /somewhere/public_html
            
             Options Indexes FollowSymLinks MultiViews ExecCGI
             AllowOverride Authconfig FileInfo
             Require all granted
            
    
    

    add the serveralias and it will recognize the IP address as well ... if you want to add more IP addresses (like local network second interface), you can add more serveralias lines ...

提交回复
热议问题