Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可否支持在baseurl加上前缀(方便配置nginx)? #1

Closed
honeytidy opened this issue Aug 16, 2021 · 4 comments
Closed

可否支持在baseurl加上前缀(方便配置nginx)? #1

honeytidy opened this issue Aug 16, 2021 · 4 comments

Comments

@honeytidy
Copy link

honeytidy commented Aug 16, 2021

服务启动时候可否加上配置url前缀的功能,服务端nginx启动的时候往往需要这个功能。
比如加上:myfile前缀,访问方式变成:localhost:3000/myfile。
另外,貌似左边菜单栏对中文显示有点问题,中文目录都显示成了:content
image

提前感谢。

@caijynb
Copy link
Owner

caijynb commented Aug 16, 2021

目录中文显示的问题是代码的bug,有空会去看一下
服务加上前缀的话,可以将clone项目后将dockerfile中的两处/var/www/html 替换成/var/www/html/myfile
再自行编译镜像:
docker build -t files:v1 .
docker run -d --name files -v /root/content:/var/www/html/content -p 3000:80 files:v1

@caijynb caijynb closed this as completed Aug 16, 2021
@honeytidy
Copy link
Author

实验了下您提供的方法,貌似不行,报如下错误:

Warning: mkdir(): Permission denied in /var/www/html/myfile/index.php on line 345

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/myfile/index.php:345) in /var/www/html/myfile/index.php on line 1045

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/myfile/index.php:345) in /var/www/html/myfile/index.php on line 1046

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/myfile/index.php:345) in /var/www/html/myfile/index.php on line 1047

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/myfile/index.php:345) in /var/www/html/myfile/index.php on line 1048

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/myfile/index.php:345) in /var/www/html/myfile/index.php on line 1049
Error
Failed to create _files

如下是我修改的Dockerfile:

FROM php:5.6.37-apache
MAINTAINER cjy0526 "1332794849@qq.com"

ADD src /var/www/html/myfile

# install gd requirement && install extensions
RUN apt-get update && apt-get install -y libgd-dev \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd mbstring fileinfo exif \
    && mkdir /var/www/html/myfile/content

EXPOSE 80

@caijynb
Copy link
Owner

caijynb commented Aug 24, 2021

看提示是权限问题,所以只需要加一行chmod 777 -R /var/www/html/myfile

FROM php:5.6.37-apache
MAINTAINER cjy0526 "1332794849@qq.com"

ADD src /var/www/html/myfile

# install gd requirement && install extensions
RUN apt-get update && apt-get install -y libgd-dev \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd mbstring fileinfo exif \
    && mkdir /var/www/html/myfile/content \
    && chmod 777 -R /var/www/html/myfile

EXPOSE 80

亲测可用

@honeytidy
Copy link
Author

能工作了,感谢感谢~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants