products:ict:servers:squid
Differences
This shows you the differences between two versions of the page.
products:ict:servers:squid [2023/10/21 06:38] – created wikiadmin | products:ict:servers:squid [2023/10/21 21:59] (current) – wikiadmin | ||
---|---|---|---|
Line 5: | Line 5: | ||
Ensure that Squid is installed on your Linux system. You can typically install it using your system' | Ensure that Squid is installed on your Linux system. You can typically install it using your system' | ||
- | ```shell | + | |
sudo apt-get update | sudo apt-get update | ||
sudo apt-get install squid | sudo apt-get install squid | ||
- | ``` | + | |
**Step 2: Basic Configuration** | **Step 2: Basic Configuration** | ||
Line 14: | Line 14: | ||
Squid' | Squid' | ||
- | ```shell | + | |
sudo cp / | sudo cp / | ||
- | ``` | + | |
Now, open the configuration file in a text editor: | Now, open the configuration file in a text editor: | ||
- | ```shell | + | |
sudo nano / | sudo nano / | ||
- | ``` | + | |
Here are some basic configuration options you may want to set: | Here are some basic configuration options you may want to set: | ||
Line 28: | Line 28: | ||
- **HTTP Port**: By default, Squid listens on port 3128. You can change this if needed. | - **HTTP Port**: By default, Squid listens on port 3128. You can change this if needed. | ||
- | ``` | + | |
- | http_port 3128 | + | http_port 3128 |
- | ``` | + | |
- **Access Control**: Define access control rules to allow or deny access to the proxy. For example, to allow all clients to connect, use: | - **Access Control**: Define access control rules to allow or deny access to the proxy. For example, to allow all clients to connect, use: | ||
- | ``` | + | |
- | acl all src all | + | acl all src all |
- | http_access allow all | + | http_access allow all |
- | ``` | + | |
- **Cache Directory**: | - **Cache Directory**: | ||
- | ``` | + | |
- | cache_dir ufs / | + | cache_dir ufs / |
- | ``` | + | |
- **Visible Hostname**: Set the hostname that users see when accessing the proxy. | - **Visible Hostname**: Set the hostname that users see when accessing the proxy. | ||
- | ``` | + | |
- | visible_hostname proxy.example.com | + | visible_hostname proxy.example.com |
- | ``` | + | |
- **Forward Proxy Settings**: If you want to use Squid as a forward proxy, specify the upstream proxy server: | - **Forward Proxy Settings**: If you want to use Squid as a forward proxy, specify the upstream proxy server: | ||
- | ``` | + | |
- | cache_peer upstream_proxy_ip parent upstream_proxy_port 0 no-query default | + | cache_peer upstream_proxy_ip parent upstream_proxy_port 0 no-query default |
- | ``` | + | |
Remember that these are basic settings. You can customize Squid further based on your requirements. Save your changes and exit the text editor. | Remember that these are basic settings. You can customize Squid further based on your requirements. Save your changes and exit the text editor. | ||
Line 63: | Line 63: | ||
Before you start Squid, it's a good practice to test your configuration for syntax errors. Run the following command: | Before you start Squid, it's a good practice to test your configuration for syntax errors. Run the following command: | ||
- | ```shell | + | |
sudo squid -k parse | sudo squid -k parse | ||
- | ``` | + | |
If there are no errors, you'll see a message like "Squid has no errors." | If there are no errors, you'll see a message like "Squid has no errors." | ||
Line 73: | Line 73: | ||
Now that your configuration is correct, start Squid and enable it to run at boot: | Now that your configuration is correct, start Squid and enable it to run at boot: | ||
- | ```shell | + | |
sudo systemctl start squid | sudo systemctl start squid | ||
+ | |||
sudo systemctl enable squid | sudo systemctl enable squid | ||
- | ``` | + | |
**Step 5: Adjust Firewall Rules** | **Step 5: Adjust Firewall Rules** | ||
Line 82: | Line 83: | ||
Ensure that your firewall allows traffic on the Squid port (default: 3128) if you have a firewall in place. For example, if you're using UFW on Ubuntu, you can run: | Ensure that your firewall allows traffic on the Squid port (default: 3128) if you have a firewall in place. For example, if you're using UFW on Ubuntu, you can run: | ||
- | ```shell | + | |
sudo ufw allow 3128/tcp | sudo ufw allow 3128/tcp | ||
- | ``` | + | |
**Step 6: Test Squid** | **Step 6: Test Squid** | ||
Line 93: | Line 94: | ||
Keep in mind that this is a basic setup. For more advanced configurations, | Keep in mind that this is a basic setup. For more advanced configurations, | ||
+ | |||
+ | |||
+ |
products/ict/servers/squid.1697852307.txt.gz · Last modified: 2023/10/21 06:38 by wikiadmin