環(huán)境安裝成功之后,要配置域名解析

假設(shè)域名: www.test.com




1 命令輸入,查找nginx配置文件路徑

find / -name nginx.conf2 打開這個目錄。

vim /etc/nginx/nginx.conf插入以下

# 包含所有的虛擬主機(jī)" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

18143453325 在線咨詢 在線咨詢
18143453325 在線咨詢
所在位置: 首頁 > 營銷資訊 > 建站知識 > 【Linux】Nginx 域名解析

【Linux】Nginx 域名解析

時間:2023-01-31 14:32:01 | 來源:建站知識

時間:2023-01-31 14:32:01 來源:建站知識

接上篇文章

環(huán)境安裝成功之后,要配置域名解析

假設(shè)域名: www.test.com




1 命令輸入,查找nginx配置文件路徑

find / -name nginx.conf2 打開這個目錄。

vim /etc/nginx/nginx.conf插入以下

# 包含所有的虛擬主機(jī)的配置文件include /etc/nginx/vhosts/*.conf;保存退出




3 在 /etc/nginx 下創(chuàng)建 vhosts 目錄

mkdir /etc/nginx/vhosts4 創(chuàng)建名字為 www.test.com.conf 文件。并復(fù)制以下內(nèi)容進(jìn)去

server { listen 80; server_name www.test.com; location / { root /usr/share/nginx/html/www.test.com/; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html/www.test.com; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/www.test.com/$fastcgi_script_name; include fastcgi_params; } location ~ /.ht { deny all; }}


保存并重啟nginx

service nginx restart


5 進(jìn)入nginx目錄: /usr/share/nginx/html

創(chuàng)建名字為 www.test.com 的文件夾 并創(chuàng)建 index.php 文件。輸入測試內(nèi)容

<?phpecho "test";?>


6 瀏覽器訪問你得域名















關(guān)鍵詞:

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點(diǎn)擊下載Chrome瀏覽器
關(guān)閉