以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的登录页面

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