리눅스 심볼릭 링크 후 그누보드 URL에 심볼릭 폴더 노출문의 채택완료

1년 전 조회 3,123

안녕하세요.

 

리눅스 스토리지 추가후 마운트, blkid, fstab에 등록처리 하였습니다. 

또한, 추가된 스토리지 /dev/vdb1 에 block 이란 폴더를 만들고

해당폴더를 app이란 이름으로 심볼릭 링크를 만들었습니다.

 

Copy
ln -s /block web

ls -al

sudo apt-get install tree

tree ./ -d -L 1

sudo systemctl restart apache2.service

 

web 폴더 안에는 abc라는 폴더와 def 라는 폴더안에는 각각 그누보드로 설치되어 있습니다.

 

web/abc 폴더안에 설치된 그누보드에 접근하기 위해 도메인 abc.com 으로 브라우저 주소창으로 접근하면,

abc.com/block/abc/bbs/login.php 와 같이 URL 중간에 "block/"이란 명칭이 붙어버립니다.

 

마찬가지로 web/def 접근을 위해 def.com 으로 접근하면, def.com/block/def/bbs/login.php 와 같습니다.

각 설치된 그누보드의 모든 페이지에 중간 block/폴더명/ 이 계속 노출됩니다.

 

어떻게 해결하면 좋은지 궁금합니다.

 

고수님의 조언을 부탁드립니다.

 

 

 

 

답변 1개

채택된 답변
+20 포인트

※ 서버가 뭔지 상관 없이 server config로 가능한 것 아닌가요?

  > Apache나 Nginx 설정을 수정해 block 경로가 URL에 드러나지 않도록 설정하시면 ~

 

※ Apache

Copy
<VirtualHost *:80>
    ServerName abc.com
    DocumentRoot /block/web/abc  

    <Directory /block/web/abc>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>


<VirtualHost *:80>
    ServerName def.com
    DocumentRoot /block/web/def 

    <Directory /block/web/def>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

 

※ Nginx;

Copy
server {
    listen 80;
    server_name abc.com;
    root /block/web/abc;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}


server {
    listen 80;
    server_name def.com;
    root /block/web/def;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; 
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}
로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

DocumentRoot /block/abc <Directory /block/abc> 이형태로 하니 동작하네요. 감사합니다.
~/_

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고