How to match linux+php+nginx 's picture server?

I wanted to use Ali"s oss, but I found that many configurations of Ali"s picture system could not be personalized, and the url form could not be personalized, so I decided to build my own picture server?

my server is centos7+php7+nginx
with the following questions:

Which packages need to be installed under

1.linux?
2. If I use img.abc.com as my domain name, should I let images in jpg and other formats be executed by php? how to write this nginx configuration file?
3. If there is anything else to do and experience, please let me know

May.11,2022

does the landlord want to use nginx as a static resource server? If so, you can start from the following aspects:
1, nginx as a pure static resource server
nginx can be used as a pure static resource server, do not rely on PHP, directly specify the static file path in the configuration file. The basic configuration is as follows:

http {
     gzip  on;
     server {
         listen 80;
         server_name static.com;
         
         location / {
             root   C:/image;
             autoindex on;
         }
     }
}

if you are a picture server, be sure to open the gzip module, which can improve the speed of picture access.

2, nginx as reverse proxy server
if there are many static resources, such as js, css, video, etc., you can consider scale-out, set up multiple static resource servers, and then use the nginx proxy to match the route to the corresponding server. For example:
js file corresponding domain name: static.com/js/xxx.js
css file corresponding domain name: static.com/css/xxx.css
img file corresponding domain name: static.com/img/xxx.png

you can use nginx's reverse proxy
to point static.com/js/xxx.js to 192.168.0.1 server
to point static.com/css/xxx.css to 192.168.0.2 server
to point static.com/img/xxx.png to 192.168.0.3 server


build your bandwidth by yourself is a problem. It is recommended to use Qiniu

.
Menu