以wordpress爲例在nginx上配置虛擬主機

在nginx上配置一個端口直接訪問wordpress的登錄頁面

vim /opt/nginx/conf/nginx.conf

server {
        listen   8080;
        server_name  ip:8080;
        root  <strong> /opt/nginx/html/wordpress;</strong>
     location / {

            index wp-login.php index.php index.html index.htm;
        }

     error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }



     location ~ \.php$ {
        #    root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  <strong>/opt/nginx/html/wordpress</strong>$fastcgi_script_name;
            include        fastcgi_params;
       }

瀏覽器中輸入 ip:8080 可直接訪問wordpress的登錄頁面

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章